From 3dc96bbf4d645117d0ad22e408bbb43fd3466cd8 Mon Sep 17 00:00:00 2001 From: Ethan Paul Date: Sat, 23 Nov 2019 21:04:29 -0500 Subject: [PATCH] Adapt dependency playbook to work with cent 7+8 Fix bug in bashrc ps1 --- playbooks/dependencies.yml | 33 +++++++++++++++++++++++++++++---- playbooks/files/bashrc.sh | 2 +- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/playbooks/dependencies.yml b/playbooks/dependencies.yml index 727ecd0..98a0260 100644 --- a/playbooks/dependencies.yml +++ b/playbooks/dependencies.yml @@ -1,12 +1,27 @@ --- -- hosts: all - name: Ansible python bindings +- name: Check meta environment + hosts: all tags: - always - initialize tasks: - - name: Install CentOS python bindings - when: ansible_distribution == "CentOS" + - name: Check required operating system + when: required_os is defined + assert: + that: + - required_os.split("_")[0] == ansible_distribution | lower + - required_os.split("_")[1] == ansible_distribution_major_version + fail_msg: "Host does not meet required OS specified" + success_msg: "Required OS validation succeeded" + +- name: Ansible python bindings + hosts: all + tags: + - always + - initialize + tasks: + - name: Install CentOS 8 python bindings + when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "8" become: true dnf: state: latest @@ -15,6 +30,16 @@ - python3-policycoreutils - python3-firewall + - name: Install CentoOS 7 python bindings + when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "7" + become: true + yum: + state: latest + name: + - libselinux-python + - policycoreutils-python + - python3-firewall + - name: Install Fedora python bindings when: ansible_distribution == "Fedora" become: true diff --git a/playbooks/files/bashrc.sh b/playbooks/files/bashrc.sh index 11c0ddd..62f01fb 100644 --- a/playbooks/files/bashrc.sh +++ b/playbooks/files/bashrc.sh @@ -58,4 +58,4 @@ alias date='/usr/bin/date --iso-8601=seconds' alias whatismyip='curl https://icanhazip.com/' export rc=/home/$USERNAME/.bashrc -export PS1="\[\e[0;97m\]\[\e[37m\e[1m]\]\u\[\e[1;94m\]@\[\e[94m\]\H\[\e[0;33m\]$(parse_git_branch) \[\e[37m\]\w\[\e[33m\] \[\e[0;97m\]$\[\e[0m\] " +export PS1="\[\e[0;97m\]\[\e[37m\e[1m\]\u\[\e[1;94m\]@\[\e[94m\]\H\[\e[0;33m\]$(parse_git_branch) \[\e[37m\]\w\[\e[33m\] \[\e[0;97m\]$\[\e[0m\] "