diff --git a/README.rst b/README.rst index 8494798..ffd4c5f 100644 --- a/README.rst +++ b/README.rst @@ -34,6 +34,20 @@ should be copied to ``zuul_config_gerrit_sshkey``. Role Variables -------------- +.. code-block:: yaml + + # Name of the user to be created. + # Default: zuul + zuul_user_name: zuul + + # Name of the group to be created. + # Default: zuul + zuul_user_group: zuul + + # Path of home directory to be created. + # Default: /var/lib/zuul + zuul_user_home: /var/lib/zuul + Dependencies ------------ diff --git a/defaults/main.yaml b/defaults/main.yaml index 2234416..7eb5d17 100644 --- a/defaults/main.yaml +++ b/defaults/main.yaml @@ -13,6 +13,10 @@ # under the License. --- # tasks/config.yaml +zuul_user_name: zuul +zuul_user_group: "{{ zuul_user_name }}" +zuul_user_home: "/var/lib/${{ zuul_user_name }}" + zuul_config_gearman_port: 4730 zuul_config_gearman_server: localhost @@ -22,16 +26,16 @@ zuul_config_gearman_server_log_config: /etc/zuul/gearman-logging.conf zuul_config_gerrit_port: 29418 zuul_config_gerrit_server: localhost -zuul_config_gerrit_sshkey: /var/lib/zuul/.ssh/id_rsa +zuul_config_gerrit_sshkey: "{{ zuul_user_home }}/.ssh/id_rsa" zuul_config_gerrit_user: zuul -zuul_config_merger_git_dir: /var/lib/zuul/git +zuul_config_merger_git_dir: "{{ zuul_user_home }}/git" zuul_config_merger_log_config: /etc/zuul/merger-logging.conf zuul_config_merger_zuul_url: localhost zuul_config_zuul_layout_config: /etc/zuul/layout.yaml zuul_config_zuul_log_config: /etc/zuul/server-logging.conf -zuul_config_zuul_state_dir: /var/lib/zuul +zuul_config_zuul_state_dir: "{{ zuul_user_home }}" zuul_file_gearman_logging_conf: etc/zuul/gearman-logging.conf zuul_file_merger_logging_conf: etc/zuul/merger-logging.conf diff --git a/tasks/config.yaml b/tasks/config.yaml index ffce531..a4e06aa 100644 --- a/tasks/config.yaml +++ b/tasks/config.yaml @@ -12,16 +12,21 @@ # License for the specific language governing permissions and limitations # under the License. --- -- name: Create system user account. +- name: Create group account. + group: + name: "{{ zuul_user_group }}" + +- name: Create user account. user: createhome: yes - home: /var/lib/zuul - name: zuul + home: "{{ zuul_user_home }}" + group: "{{ zuul_user_group }}" + name: "{{ zuul_user_name }}" - name: Create required directories. file: - group: zuul - owner: zuul + group: "{{ zuul_user_group }}" + owner: "{{ zuul_user_name }}" path: "{{ item }}" state: directory with_items: