diff --git a/.travis.yml b/.travis.yml index 4686eb7..af9a40d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,4 +31,13 @@ script: # Make sure Ansible is installed (yes, this is contrived, since Ansible was # already installed via pip earlier...). - - "which ansible" \ No newline at end of file + - "which ansible" + + # Run the playbook for all users. + - 'ansible-playbook -i tests/inventory tests/$SITE --connection=local --sudo -e "liquidprompt_apply_all_users=True"' + + # Ensure the liquidprompt bash file was copied system wide. + - > + [[ -f /etc/profile.d/liquidprompt.sh ]] + && (echo 'System wide liquidprompt test: pass' && exit 0) + || (echo 'System wide liquidprompt test: fail' && exit 1) diff --git a/tasks/all-users-debian.yml b/tasks/all-users-debian.yml index 5124ded..5606f5d 100644 --- a/tasks/all-users-debian.yml +++ b/tasks/all-users-debian.yml @@ -3,10 +3,4 @@ # Option 1: Add liquidprompt to all users - name: Copy template - template: src=liquidprompt.bashrc.j2 dest=/etc/liquidprompt.bashrc owner=root - -- name: Add source file to bashrc - lineinfile: - dest: /etc/bash.bashrc - line: "source /etc/liquidprompt.bashrc" - owner: root + template: src=liquidprompt.bashrc.j2 dest=/etc/profile.d/liquidprompt.sh owner=root diff --git a/tasks/install_packages_Debian.yml b/tasks/install_packages_Debian.yml new file mode 100644 index 0000000..47aa3a0 --- /dev/null +++ b/tasks/install_packages_Debian.yml @@ -0,0 +1,6 @@ +--- +- name: Install packages for Debian + apt: name={{ item }} state=present update_cache=yes cache_valid_time=86400 + when: ansible_pkg_mgr == 'apt' + with_items: + - git diff --git a/tasks/install_packages_RedHat.yml b/tasks/install_packages_RedHat.yml new file mode 100644 index 0000000..e45c0e2 --- /dev/null +++ b/tasks/install_packages_RedHat.yml @@ -0,0 +1,6 @@ +--- +- name: Install dependency packages for RedHat + yum: name={{ item }} state=present + when: ansible_pkg_mgr == 'yum' + with_items: + - git diff --git a/tasks/main.yml b/tasks/main.yml index 170b9d6..4f75aad 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,4 +1,11 @@ --- +- include: install_packages_Debian.yml + sudo: yes + when: ansible_os_family == 'Debian' + +- include: install_packages_RedHat.yml + sudo: yes + when: ansible_os_family == 'RedHat' - name: Clone liquidprompt git: "repo=https://github.com/nojhan/liquidprompt.git dest={{ liquidprompt_path }}" @@ -7,4 +14,4 @@ when: liquidprompt_enable_all_users == true - include: specific-users.yml - when: liquidprompt_enable_all_users == false \ No newline at end of file + when: liquidprompt_enable_all_users == false