From b51656ae5b62a44f633467ca289f447cd49db1a5 Mon Sep 17 00:00:00 2001 From: William Graef Date: Tue, 12 Nov 2024 09:11:23 -0500 Subject: [PATCH 1/3] add var to enable single host install --- olam/create_instance.yml | 4 +++- olam/default_vars.yml | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/olam/create_instance.yml b/olam/create_instance.yml index 679f4d6..4881183 100644 --- a/olam/create_instance.yml +++ b/olam/create_instance.yml @@ -314,7 +314,9 @@ ansible.builtin.include_tasks: deploy-olam-tasks.yml vars: control_node_ip: "{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}" - when: inventory_hostname == 'olam-node' + when: + - inventory_hostname == 'olam-node' + - olam_single_host - name: Update all rpm packages ansible.builtin.import_playbook: update_all_rpms.yml diff --git a/olam/default_vars.yml b/olam/default_vars.yml index 3197a96..8793fcc 100644 --- a/olam/default_vars.yml +++ b/olam/default_vars.yml @@ -19,4 +19,5 @@ block_volume_size_in_gbs: 50 block_count: 1 update_all: false -passwordless_ssh: true \ No newline at end of file +passwordless_ssh: true +olam_single_host: false \ No newline at end of file From 558d25bc751709aafae38251185a74fe6e9888dd Mon Sep 17 00:00:00 2001 From: William Graef Date: Tue, 12 Nov 2024 12:33:38 -0500 Subject: [PATCH 2/3] update olam install tasks --- olam/create_instance.yml | 4 ++-- olam/olam_passwordless_setup.yml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/olam/create_instance.yml b/olam/create_instance.yml index 4881183..ee922b0 100644 --- a/olam/create_instance.yml +++ b/olam/create_instance.yml @@ -314,8 +314,8 @@ ansible.builtin.include_tasks: deploy-olam-tasks.yml vars: control_node_ip: "{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}" - when: - - inventory_hostname == 'olam-node' + when: + - inventory_hostname in groups['control'] - olam_single_host - name: Update all rpm packages diff --git a/olam/olam_passwordless_setup.yml b/olam/olam_passwordless_setup.yml index 7e5b9d3..f067c97 100644 --- a/olam/olam_passwordless_setup.yml +++ b/olam/olam_passwordless_setup.yml @@ -51,6 +51,6 @@ become_user: "{{ username }}" register: result changed_when: result.rc == 0 - when: - - "'remote' in groups" - - inventory_hostname in groups['control'] + when: + - "'remote' in groups" + - inventory_hostname in groups['control'] From 6a84fb358c3e1cd8bc1500c504cca7c32451d522 Mon Sep 17 00:00:00 2001 From: William Graef Date: Wed, 13 Nov 2024 08:44:24 -0500 Subject: [PATCH 3/3] fix lint errors --- olam/deploy-olam-tasks.yml | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/olam/deploy-olam-tasks.yml b/olam/deploy-olam-tasks.yml index 1b06821..d8622a7 100644 --- a/olam/deploy-olam-tasks.yml +++ b/olam/deploy-olam-tasks.yml @@ -29,7 +29,7 @@ - python3-pyOpenSSL - python3-pip enablerepo: ol8_developer_EPEL - state: latest + state: present - name: Install pexpect using pip ansible.builtin.pip: @@ -46,6 +46,7 @@ stream=13 profiles= state=enabled + mode: '0644' when: - ansible_distribution_major_version | int >= 8 @@ -60,7 +61,7 @@ owner: "postgres" group: "postgres" state: directory - mode: "0700" + mode: '0700' # Handle the ol-automation-manager-DB-init.sh script @@ -69,11 +70,13 @@ path: "/var/lib/pgsql/data/PG_VERSION" register: pgdata_dir_version -- name: initialize postgresql database +- name: Initialize postgresql database ansible.builtin.command: "postgresql-setup --initdb" when: not pgdata_dir_version.stat.exists become: true become_user: postgres + register: dbsetup_result + changed_when: dbsetup_result.rc == 0 - name: Change database password storage encryption ansible.builtin.replace: @@ -99,6 +102,7 @@ community.postgresql.postgresql_db: name: awx owner: awx + become: true become_user: postgres - name: Update host-based authentication @@ -125,20 +129,20 @@ state: present - name: Disable Oracle Linux Automation Manager 1.0 repository - ansible.builtin.ini_file: + community.general.ini_file: path: "/etc/yum.repos.d/oraclelinux-automation-manager-ol8.repo" section: ol8_automation1 option: enabled value: "0" - mode: "0644" + mode: '0644' - name: Enable Oracle Linux Automation Manager 2.0 repository - ansible.builtin.ini_file: + community.general.ini_file: path: "/etc/yum.repos.d/oraclelinux-automation-manager-ol8.repo" section: ol8_automation2 option: enabled value: "1" - mode: "0644" + mode: '0644' - name: Install Oracle Linux Automation Manager ansible.builtin.dnf: @@ -251,19 +255,19 @@ - name: Remove default server section in nginx configuration ansible.builtin.template: - src: ../templates/nginx.conf.j2 + src: nginx.conf.j2 dest: /etc/nginx/nginx.conf owner: root group: root - mode: "0644" + mode: '0644' - name: Remove default configuration in receptor ansible.builtin.template: - src: ../templates/receptor.conf.j2 + src: receptor.conf.j2 dest: /etc/receptor/receptor.conf owner: root group: root - mode: "0644" + mode: '0644' - name: Set firewall service rules ansible.posix.firewalld: @@ -301,4 +305,6 @@ - name: Enable lingering is needed ansible.builtin.command: "loginctl enable-linger awx" + register: linger_result + changed_when: linger_result.rc == 0 when: not user_lingering.stat.exists