From eeb1f2109cd55e795f8c9d0d8ee6bb834a5e27c9 Mon Sep 17 00:00:00 2001 From: willtome Date: Mon, 16 Jan 2023 12:02:51 -0500 Subject: [PATCH] Issue 52 (#53) * add fact scan * add fact scan * update patching role * dont ask limit * add become --- .../patching/roles/patch_linux/tasks/main.yml | 11 +++++----- linux/fact_scan.yml | 12 +++++++++++ linux/service_start.yml | 1 + linux/service_stop.yml | 3 ++- linux/setup.yml | 20 ++++++++++--------- 5 files changed, 31 insertions(+), 16 deletions(-) create mode 100644 linux/fact_scan.yml diff --git a/collections/ansible_collections/demo/patching/roles/patch_linux/tasks/main.yml b/collections/ansible_collections/demo/patching/roles/patch_linux/tasks/main.yml index 512a900..410d37c 100644 --- a/collections/ansible_collections/demo/patching/roles/patch_linux/tasks/main.yml +++ b/collections/ansible_collections/demo/patching/roles/patch_linux/tasks/main.yml @@ -1,11 +1,10 @@ --- -- name: Scan packages - demo.patching.scan_packages: - os_family: "{{ ansible_os_family }}" +- name: get packages + ansible.builtin.package_facts: check_mode: no -- name: Scan services - demo.patching.scan_services: +- name: get services + ansible.builtin.service_facts: check_mode: no - name: upgrade packages (yum) @@ -35,4 +34,4 @@ ansible.builtin.reboot: when: - result.rc == 1 - - allow_reboot == true \ No newline at end of file + - allow_reboot == true diff --git a/linux/fact_scan.yml b/linux/fact_scan.yml new file mode 100644 index 0000000..1c26ff0 --- /dev/null +++ b/linux/fact_scan.yml @@ -0,0 +1,12 @@ +--- +- hosts: "{{ HOSTS }}" + become: yes + + tasks: + - name: get packages + ansible.builtin.package_facts: + + - name: get services + ansible.builtin.service_facts: + + \ No newline at end of file diff --git a/linux/service_start.yml b/linux/service_start.yml index 81979ea..b8b650a 100644 --- a/linux/service_start.yml +++ b/linux/service_start.yml @@ -1,5 +1,6 @@ --- - hosts: "{{ HOSTS }}" + become: yes vars: service_name: undef diff --git a/linux/service_stop.yml b/linux/service_stop.yml index 4ab01b1..4cfb791 100644 --- a/linux/service_stop.yml +++ b/linux/service_stop.yml @@ -1,5 +1,6 @@ --- - hosts: "{{ HOSTS }}" + become: yes vars: service_name: undef @@ -11,4 +12,4 @@ service: name: "{{ service_name }}" state: stopped - when: service_name + '.service' in services \ No newline at end of file + when: service_name + '.service' in services diff --git a/linux/setup.yml b/linux/setup.yml index 502b339..b86cbf0 100644 --- a/linux/setup.yml +++ b/linux/setup.yml @@ -10,12 +10,6 @@ controller_components: - inventory_sources - job_templates -controller_projects: - - name: Fact Scan - organization: Default - scm_type: git - scm_url: 'https://github.com/ansible/awx-facts-playbooks.git' - controller_credential_types: - name: "Insights Collection" kind: cloud @@ -233,16 +227,24 @@ controller_templates: required: true - name: "LINUX / Fact Scan" - project: Fact Scan - playbook: scan_facts.yml + project: "Ansible official demo project" + playbook: linux/fact_scan.yml inventory: Workshop Inventory notification_templates_started: Telemetry notification_templates_success: Telemetry notification_templates_error: Telemetry - ask_limit_on_launch: true use_fact_cache: true credentials: - Workshop Credential + survey_enabled: true + survey: + name: '' + description: '' + spec: + - question_name: Server Name or Pattern + type: text + variable: HOSTS + required: true - name: "LINUX / Podman Webserver" job_type: run