working disable/enable services
This commit is contained in:
1 parent
3de1cd1c9b
commit
342c00eda6
6 files changed
+69
-30
No files matched your search
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
- name: Disable services
|
||||||
|
ansible.builtin.command: "pro disable {{ item }}"
|
||||||
|
become: yes
|
||||||
|
register: reg_pro_disable
|
||||||
|
when: item in ubuntu_pro_services
|
||||||
|
loop: "{{ disabled_services }}"
|
||||||
|
changed_when: reg_pro_disable.rc == 0
|
||||||
|
failed_when:
|
||||||
|
- reg_pro_disable.rc != 0
|
||||||
|
- ('is not currently enabled' not in reg_pro_disable.stdout_lines[0])
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
- name: Enable services
|
||||||
|
ansible.builtin.command: "pro enable {{ item }}"
|
||||||
|
become: yes
|
||||||
|
register: reg_pro_enable
|
||||||
|
when: item in ubuntu_pro_services
|
||||||
|
loop: "{{ enabled_services }}"
|
||||||
|
changed_when: reg_pro_enable.rc == 0
|
||||||
|
failed_when:
|
||||||
|
- reg_pro_enable.rc != 0
|
||||||
|
- ('is already enabled' not in reg_pro_enable.stdout_lines[1] and 'is not available for' not in reg_pro_enable.stdout_lines[1])
|
||||||
+14
-23
@@ -1,29 +1,20 @@
|
|||||||
---
|
---
|
||||||
- include_tasks: validate_ubuntu_lts_version.yml
|
- name: Include tasks 'validate_ubuntu_lts_version.yml'
|
||||||
|
include_tasks: validate_ubuntu_lts_version.yml
|
||||||
|
|
||||||
- name: Launch 'apt update'
|
# - name: Include tasks 'requirements.yml'
|
||||||
ansible.builtin.apt:
|
# include_tasks: requirements.yml
|
||||||
update_cache: yes
|
|
||||||
become: yes
|
|
||||||
|
|
||||||
- name: Launch 'apt upgrade'
|
- name: Include tasks 'configure.yml'
|
||||||
ansible.builtin.apt:
|
include_tasks: configure.yml
|
||||||
upgrade: yes
|
|
||||||
become: yes
|
|
||||||
|
|
||||||
- name: Install 'ubuntu-advantage-tools' package
|
- name: Include tasks 'register.yml'
|
||||||
ansible.builtin.apt:
|
include_tasks: register.yml
|
||||||
name: ubuntu-advantage-tools
|
|
||||||
state: latest
|
|
||||||
become: yes
|
|
||||||
|
|
||||||
- include_tasks: configure.yml
|
- name: Include tasks 'enable_services.yml'
|
||||||
|
include_tasks: enable_services.yml
|
||||||
|
when: enabled_services is defined
|
||||||
|
|
||||||
- name: Register this host on Ubuntu Pro (pro attach <token>)
|
- name: Include tasks 'disable_services.yml'
|
||||||
ansible.builtin.command: "pro attach {{ ubuntu_pro_token }}"
|
include_tasks: disable_services.yml
|
||||||
become: yes
|
when: disabled_services is defined
|
||||||
register: reg_pro_attach
|
|
||||||
|
|
||||||
- name: Print 'pro attach' command output
|
|
||||||
ansible.builtin.debug:
|
|
||||||
var: reg_pro_attach
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
- name: Register this host on Ubuntu Pro (pro attach <token>)
|
||||||
|
ansible.builtin.command: "pro attach {{ ubuntu_pro_token }}"
|
||||||
|
become: yes
|
||||||
|
register: reg_pro_attach
|
||||||
|
failed_when: (reg_pro_attach.rc != 0) and ('This machine is already attached to' not in reg_pro_attach.stderr_lines[0])
|
||||||
|
|
||||||
|
- name: Print 'pro attach' command output
|
||||||
|
ansible.builtin.debug:
|
||||||
|
var: reg_pro_attach
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
---
|
||||||
|
- name: Launch 'apt update'
|
||||||
|
ansible.builtin.apt:
|
||||||
|
update_cache: yes
|
||||||
|
become: yes
|
||||||
|
|
||||||
|
- name: Launch 'apt upgrade'
|
||||||
|
ansible.builtin.apt:
|
||||||
|
upgrade: yes
|
||||||
|
become: yes
|
||||||
|
|
||||||
|
- name: Install 'ubuntu-advantage-tools' package
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name: ubuntu-advantage-tools
|
||||||
|
state: latest
|
||||||
|
become: yes
|
||||||
+7
-7
@@ -18,10 +18,10 @@ ubuntu_pro_lts_releases:
|
|||||||
# update_status_timer: 43200
|
# update_status_timer: 43200
|
||||||
# metering_timer: 14400
|
# metering_timer: 14400
|
||||||
|
|
||||||
# ubuntu_pro_services:
|
ubuntu_pro_services:
|
||||||
# - 'cc-eal' # Common Criteria EAL2
|
- 'cc-eal' # Common Criteria EAL2
|
||||||
# - 'esm-infra' # Expanded Security Maintenance for Infrastructure
|
- 'esm-infra' # Expanded Security Maintenance for Infrastructure
|
||||||
# - 'fips'
|
- 'fips'
|
||||||
# - 'fips-updates'
|
- 'fips-updates'
|
||||||
# - 'livepatch' # Canonical Kernel Livepatch
|
- 'livepatch' # Canonical Kernel Livepatch
|
||||||
# - 'usg' # Ubuntu Security Guide
|
- 'usg' # Ubuntu Security Guide
|
||||||
Reference in new issue
Block a user