- import_tasks: apt_systems.yml
when: ansible_pkg_mgr == "apt"
+- import_tasks: zypper_systems.yml
+ when: ansible_pkg_mgr == "zypper"
+
- name: Create the user
user:
- name: pulpito
+ name: "{{ pulpito_user }}"
state: present
shell: /bin/bash
+ tags:
+ - user
- name: Set repo location
set_fact:
- pulpito_repo_path: "/home/pulpito/pulpito"
-
-- name: Checkout the repo
- git:
- repo: "{{ pulpito_repo }}"
- dest: "{{ pulpito_repo_path }}"
- become_user: pulpito
-
-- name: Look for the virtualenv
- stat:
- path: "{{ pulpito_repo_path }}/virtualenv"
- get_checksum: no
- get_md5: no
- register: virtualenv
-
-- name: Create the virtualenv
- shell: virtualenv ./virtualenv chdir={{ pulpito_repo_path }}
- become_user: pulpito
- when: virtualenv.stat.exists == false
-
-- name: Install requirements via pip
- pip:
- chdir: "{{ pulpito_repo_path }}"
- requirements: "./requirements.txt"
- virtualenv: "{{ pulpito_repo_path }}/virtualenv"
- no_log: true
- become_user: pulpito
-
-- name: Check for pulpito config
- stat:
- path: "{{ pulpito_repo_path }}/prod.py"
- get_checksum: no
- get_md5: no
- register: pulpito_config
+ pulpito_repo_path: "/home/{{ pulpito_user }}/pulpito"
-- name: Copy pulpito config
- shell: cp ./config.py.in prod.py chdir={{ pulpito_repo_path }}
- when: pulpito_config.stat.exists == false
- become_user: pulpito
+# Set up the actual pulpito project
+- import_tasks: setup_pulpito.yml
-- name: Set paddles_address
- lineinfile:
- dest: "{{ pulpito_repo_path }}/prod.py"
- regexp: "^paddles_address = "
- line: "paddles_address = '{{ paddles_address|mandatory }}'"
- register: pulpito_config
- name: Enable supervisord
service:
- name: Read supervisord config
command: supervisorctl update
- when: supervisor_conf|changed
+ when: supervisor_conf is changed
- name: Check if pulpito is running
command: supervisorctl status pulpito
supervisorctl:
name: pulpito
state: restarted
- when: pulpito_status.stdout|match('.*RUNNING.*') and pulpito_config|changed
+ when: pulpito_status.stdout is match('.*RUNNING.*') and pulpito_config is changed
- name: Wait for pulpito to start
wait_for:
--- /dev/null
+---
+- name: Checkout the repo
+ git:
+ repo: "{{ pulpito_repo }}"
+ dest: "{{ pulpito_repo_path }}"
+ become_user: "{{ pulpito_user }}"
+ tags:
+ - repos
+
+- name: Look for the virtualenv
+ stat:
+ path: "{{ pulpito_repo_path }}/virtualenv"
+ get_checksum: no
+ get_md5: no
+ register: virtualenv
+
+- name: Create the virtualenv
+ shell: virtualenv ./virtualenv chdir={{ pulpito_repo_path }}
+ become_user: "{{ pulpito_user }}"
+ when: virtualenv.stat.exists == false
+
+- name: Self-upgrade pip
+ pip:
+ name: "pip"
+ state: "latest"
+ chdir: "{{ pulpito_repo_path }}"
+ virtualenv: "{{ pulpito_repo_path }}/virtualenv"
+ become_user: "{{ pulpito_user }}"
+
+- name: Install requirements via pip
+ pip:
+ chdir: "{{ pulpito_repo_path }}"
+ requirements: "./requirements.txt"
+ virtualenv: "{{ pulpito_repo_path }}/virtualenv"
+ #no_log: true
+ become_user: "{{ pulpito_user }}"
+
+- name: Check for pulpito config
+ stat:
+ path: "{{ pulpito_repo_path }}/prod.py"
+ get_checksum: no
+ get_md5: no
+ register: pulpito_config
+
+- name: Copy pulpito config
+ shell: cp ./config.py.in prod.py chdir={{ pulpito_repo_path }}
+ when: pulpito_config.stat.exists == false
+ become_user: "{{ pulpito_user }}"
+
+- name: Set paddles_address
+ lineinfile:
+ dest: "{{ pulpito_repo_path }}/prod.py"
+ regexp: "^paddles_address = "
+ line: "paddles_address = '{{ paddles_address|mandatory }}'"
+ register: pulpito_config
+