From: Andrew Schoen Date: Fri, 20 Mar 2015 14:52:02 +0000 (-0500) Subject: Made the teuthology user a var X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=364280244bbb61e3a3f4494ee3fc0a1802876bcb;p=ceph-cm-ansible.git Made the teuthology user a var This will allow us to more easily change the user teuthology uses to run tests against these nodes in the future. Signed-off-by: Andrew Schoen --- diff --git a/roles/common/defaults/main.yml b/roles/common/defaults/main.yml index 4c18529..fde3009 100644 --- a/roles/common/defaults/main.yml +++ b/roles/common/defaults/main.yml @@ -37,3 +37,6 @@ yum_repos: {} # packages are defined in the pkg manager # specific var files. packages: [] + +# the user teuthology will use +teuthology_user: "ubuntu" diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index 15b92e6..ec883bf 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -7,10 +7,10 @@ # configure pip to use our mirror - include: pip.yml -- name: Set a high max open files limit +- name: Set a high max open files limit for the teuthology user. template: src: security_limits.conf - dest: /etc/security/limits.d/ubuntu.conf + dest: "/etc/security/limits.d/{{ teuthology_user }}.conf" owner: root group: root mode: 0755 diff --git a/roles/common/tasks/pip.yml b/roles/common/tasks/pip.yml index 4aa70d0..0fe23ab 100644 --- a/roles/common/tasks/pip.yml +++ b/roles/common/tasks/pip.yml @@ -1,16 +1,16 @@ --- -- name: Create /home/ubuntu/.pip +- name: Create the .pip directory for the teuthology user. file: - path: /home/ubuntu/.pip - owner: ubuntu - group: ubuntu + path: "/home/{{ teuthology_user }}/.pip" + owner: "{{ teuthology_user }}" + group: "{{ teuthology_user }}" mode: 0644 state: directory - name: Create pip.conf and configure it to use our mirror template: src: pip.conf - dest: /home/ubuntu/.pip/pip.conf - owner: ubuntu - group: ubuntu + dest: "/home/{{ teuthology_user }}/.pip/pip.conf" + owner: "{{ teuthology_user }}" + group: "{{ teuthology_user }}" mode: 0644 diff --git a/roles/common/tasks/redhat/rhel_7.0.yml b/roles/common/tasks/redhat/rhel_7.0.yml index 458a2b4..a1c09e0 100644 --- a/roles/common/tasks/redhat/rhel_7.0.yml +++ b/roles/common/tasks/redhat/rhel_7.0.yml @@ -19,16 +19,16 @@ name: "{{ new_hostname.stdout }}" when: existing_hostname.stdout.find("{{ lab_domain | mandatory }}") != -1 -- name: Add ubuntu CPAN config directory. +- name: Add CPAN config directory for the teuthology user. file: - path: /home/ubuntu/.cpan/CPAN/ - owner: ubuntu - group: ubuntu + path: "/home/{{ teuthology_user }}/.cpan/CPAN/" + owner: "{{ teuthology_user }}" + group: "{{ teuthology_user }}" mode: 0755 recurse: yes state: directory -- name: Add root CPAN config directory. +- name: Add CPAN config directory for the root user. file: path: /root/.cpan/CPAN/ owner: root @@ -37,12 +37,12 @@ recurse: yes state: directory -- name: Upload CPAN config for ubuntu. +- name: Upload CPAN config for the teuthology user. template: src: ../../templates/cpan_config.pm - dest: /home/ubuntu/.cpan/CPAN/MyConfig.pm - owner: ubuntu - group: ubuntu + dest: "/home/{{ teuthology_user }}/.cpan/CPAN/MyConfig.pm" + owner: "{{ teuthology_user }}" + group: "{{ teuthology_user }}" mode: 0755 - name: Upload CPAN config for root. diff --git a/roles/common/tasks/setup-redhat.yml b/roles/common/tasks/setup-redhat.yml index b25edd7..5399584 100644 --- a/roles/common/tasks/setup-redhat.yml +++ b/roles/common/tasks/setup-redhat.yml @@ -32,9 +32,9 @@ path: /etc/fuse.conf mode: 0644 -- name: Add user ubuntu to group kvm +- name: Add the teuthology user to group kvm user: - name: ubuntu + name: "{{ teuthology_user }}" group: kvm - name: Upload rhel version specific sshd_config. diff --git a/roles/common/templates/cpan_config.pm b/roles/common/templates/cpan_config.pm index b295306..1d33d94 100644 --- a/roles/common/templates/cpan_config.pm +++ b/roles/common/templates/cpan_config.pm @@ -3,7 +3,7 @@ $CPAN::Config = { 'applypatch' => q[], 'auto_commit' => q[0], 'build_cache' => q[100], - 'build_dir' => q[/home/ubuntu/.cpan/build], + 'build_dir' => q[/home/{{ teuthology_user }}/.cpan/build], 'build_dir_reuse' => q[0], 'build_requires_install_policy' => q[yes], 'bzip2' => q[/bin/bzip2], @@ -12,20 +12,20 @@ $CPAN::Config = { 'colorize_output' => q[0], 'commandnumber_in_prompt' => q[1], 'connect_to_internet_ok' => q[1], - 'cpan_home' => q[/home/ubuntu/.cpan], + 'cpan_home' => q[/home/{{ teuthology_user }}/.cpan], 'ftp_passive' => q[1], 'ftp_proxy' => q[], 'getcwd' => q[cwd], 'gpg' => q[/usr/bin/gpg], 'gzip' => q[/bin/gzip], 'halt_on_failure' => q[0], - 'histfile' => q[/home/ubuntu/.cpan/histfile], + 'histfile' => q[/home/{{ teuthology_user }}/.cpan/histfile], 'histsize' => q[100], 'http_proxy' => q[], 'inactivity_timeout' => q[0], 'index_expire' => q[1], 'inhibit_startup_message' => q[0], - 'keep_source_where' => q[/home/ubuntu/.cpan/sources], + 'keep_source_where' => q[/home/{{ teuthology_user }}/.cpan/sources], 'load_module_verbosity' => q[none], 'make' => q[/usr/bin/make], 'make_arg' => q[], @@ -42,7 +42,7 @@ $CPAN::Config = { 'perl5lib_verbosity' => q[none], 'prefer_external_tar' => q[1], 'prefer_installer' => q[MB], - 'prefs_dir' => q[/home/ubuntu/.cpan/prefs], + 'prefs_dir' => q[/home/{{ teuthology_user }}/.cpan/prefs], 'prerequisites_policy' => q[follow], 'scan_cache' => q[atstart], 'shell' => q[/bin/bash], diff --git a/roles/common/templates/security_limits.conf b/roles/common/templates/security_limits.conf index 2dd4f3e..1c515b2 100644 --- a/roles/common/templates/security_limits.conf +++ b/roles/common/templates/security_limits.conf @@ -1,2 +1,2 @@ # {{ ansible_managed }} -ubuntu hard nofile 16384 +{{ teuthology_user }} hard nofile 16384 diff --git a/roles/common/templates/sudoers b/roles/common/templates/sudoers index 8d107bf..571cb98 100755 --- a/roles/common/templates/sudoers +++ b/roles/common/templates/sudoers @@ -42,4 +42,4 @@ root ALL=(ALL) ALL ## Allows people in group wheel to run all commands %wheel ALL=(ALL) ALL -ubuntu ALL=(ALL) NOPASSWD:ALL +{{ teuthology_user }} ALL=(ALL) NOPASSWD:ALL