--- - name: Container Setup vars: lxc_base: ansible-alpine3.11 lxc_name: mkdocs import_playbook: ../common/tasks/lxc.yml - name: Installing MkDocs hosts: mkdocs vars_files: - ../variables.yml tasks: - name: Ensuring group exists group: name: "{{ mkdocs_user }}" state: present - name: Creating user and making home directory user: system: yes state: present name: "{{ mkdocs_user }}" groups: "{{ mkdocs_user }}" home: "{{ mkdocs_home }}" - name: Installing the required dependencies apk: state: present update_cache: yes name: - sudo - git - supervisor - block: - name: Setting up python virtual environment shell: python3 -m venv . args: chdir: "{{ mkdocs_home }}" creates: bin/activate - name: Installing application shell: | . bin/activate pip install git+https://github.com/mkdocs/mkdocs@{{ mkdocs_version }} pip install -Iv mkdocs-material=={{ mkdocs_material_version }} args: chdir: "{{ mkdocs_home }}" creates: bin/mkdocs - name: Copying config file copy: src: mkdocs.yml dest: "{{ mkdocs_home }}" mode: '0644' register: mkdocsConfig - name: Creating document directory file: path: "{{ mkdocs_home }}/docs" state: directory - name: Copying index file copy: src: index.md dest: "{{ mkdocs_home }}/docs" mode: '0644' become: true become_user: "{{ mkdocs_user }}" - name: Copying supervisord config file copy: src: supervisord.conf dest: /etc/supervisord.conf mode: '0644' - name: Ensuring supervisord has been started and enabled service: name: supervisord state: restarted enabled: yes - name: Waiting for supervisor to become active wait_for: port: 9100 - name: Ensuring application has been started supervisorctl: name: mkdocs state: restarted - name: Waiting for application to become active wait_for: port: 8000 - name: Testing if webpage exists uri: url: http://0.0.0.0:8000 return_content: yes