From 0401eb333b89bc08826dd39872f58bc0f32a361e Mon Sep 17 00:00:00 2001 From: Caleb Fultz Date: Fri, 12 Jul 2024 15:51:27 -0400 Subject: [PATCH] mixed linux environments playbooks --- mixed-linux-environments/ansible.cfg | 5 +++ mixed-linux-environments/install_apache.yml | 38 +++++++++++++++++++++ mixed-linux-environments/inventory | 4 +++ mixed-linux-environments/remove_apache.yml | 38 +++++++++++++++++++++ 4 files changed, 85 insertions(+) create mode 100644 mixed-linux-environments/ansible.cfg create mode 100644 mixed-linux-environments/install_apache.yml create mode 100644 mixed-linux-environments/inventory create mode 100644 mixed-linux-environments/remove_apache.yml diff --git a/mixed-linux-environments/ansible.cfg b/mixed-linux-environments/ansible.cfg new file mode 100644 index 0000000..0056832 --- /dev/null +++ b/mixed-linux-environments/ansible.cfg @@ -0,0 +1,5 @@ +[defaults] +inventory = inventory +private_key_file = ~/.ssh/hetzner + + diff --git a/mixed-linux-environments/install_apache.yml b/mixed-linux-environments/install_apache.yml new file mode 100644 index 0000000..a39039d --- /dev/null +++ b/mixed-linux-environments/install_apache.yml @@ -0,0 +1,38 @@ +--- +- hosts: all + become: true + tasks: + + - name: Update repository index + ansible.builtin.package: + update_cache: yes + +#### Ubuntu/Debian Section #### + + - name: Install apache2 package + package: + name: apache2 + state: latest + when: ansible_os_family == "Debian" + + - name: Install support for php + package: + name: libapache2-mod-php + state: latest + when: ansible_os_family == "Debian" + +#### EL Section #### + + + + - name: Install apache2 package + package: + name: httpd + state: latest + when: ansible_os_family == "RedHat" + + - name: Install support for php + package: + name: php + state: latest + when: ansible_os_family == "RedHat" diff --git a/mixed-linux-environments/inventory b/mixed-linux-environments/inventory new file mode 100644 index 0000000..581ac69 --- /dev/null +++ b/mixed-linux-environments/inventory @@ -0,0 +1,4 @@ +10.0.0.5 +10.0.0.7 +10.0.0.8 +10.0.0.11 diff --git a/mixed-linux-environments/remove_apache.yml b/mixed-linux-environments/remove_apache.yml new file mode 100644 index 0000000..b34b0f2 --- /dev/null +++ b/mixed-linux-environments/remove_apache.yml @@ -0,0 +1,38 @@ +--- +- hosts: all + become: true + tasks: + + - name: Update repository index + ansible.builtin.package: + update_cache: yes + +#### Ubuntu/Debian Section #### + + - name: Install apache2 package + package: + name: apache2 + state: absent + when: ansible_os_family == "Debian" + + - name: Install support for php + package: + name: libapache2-mod-php + state: absent + when: ansible_os_family == "Debian" + +#### EL Section #### + + + + - name: Install apache2 package + package: + name: httpd + state: absent + when: ansible_os_family == "RedHat" + + - name: Install support for php + package: + name: php + state: absent + when: ansible_os_family == "RedHat"