add 'pro config' feature
This commit is contained in:
1 parent
2a6201bdfa
commit
3de1cd1c9b
5 files changed
+113
-6
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
# Ansible Role : ubuntu_pro
|
# Ansible Role : ubuntu_pro
|
||||||
|
|
||||||
An Ansible Role that registers host on [Ubuntu Pro](https://ubuntu.com/pro).
|
An Ansible Role that registers and configures host with [Ubuntu Pro](https://ubuntu.com/pro).
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
@@ -10,11 +10,25 @@ Ubuntu Pro is only available for every **Ubuntu LTS releases from 16.04 LTS**.
|
|||||||
|
|
||||||
## Roles Variables
|
## Roles Variables
|
||||||
|
|
||||||
The only mandatory variable for this role is `ubuntu_pro_token`.
|
The only mandatory variable is `ubuntu_pro_token`.
|
||||||
|
|
||||||
```yaml
|
| Variable | Description | Type | Mandatory | Default Value |
|
||||||
ubuntu_pro_token: <ubuntu_pro_token>
|
|--------------------------------------------|----------------------------------|--------|-----------|---------------|
|
||||||
```
|
| `ubuntu_pro_token` | Ubuntu Pro token | String | YES | None |
|
||||||
|
||||||
|
||||||
|
| `ubuntu_pro_config.http_proxy` | HTTP Proxy | String | NO | None |
|
||||||
|
| `ubuntu_pro_config.http_proxy` | HTTPS Proxy | String | NO | None |
|
||||||
|
| `ubuntu_pro_config.apt_http_proxy` | APT HTTP Proxy | String | NO | None |
|
||||||
|
| `ubuntu_pro_config.apt_https_proxy` | APT HTTPS Proxy | String | NO | None |
|
||||||
|
| `ubuntu_pro_config.ua_apt_http_proxy` | UA APT HTTP Proxy | String | NO | None |
|
||||||
|
| `ubuntu_pro_config.ua_apt_https_proxy` | UA APT HTTPS Proxy | String | NO | None |
|
||||||
|
| `ubuntu_pro_config.gloabl_apt_http_proxy` | Global APT HTTP Proxy | String | NO | None |
|
||||||
|
| `ubuntu_pro_config.global_apt_https_proxy` | Global APT HTTPS Proxy | String | NO | None |
|
||||||
|
| `ubuntu_pro_config.update_messaging_timer` | Update Messaging Timer | Int | NO | `21600` |
|
||||||
|
| `ubuntu_pro_config.update_status_timer` | Update Status Timer | Int | NO | `43200` |
|
||||||
|
| `ubuntu_pro_config.metering_timer` | Metering Timer | Int | NO | `14400` |
|
||||||
|
|
||||||
|
You can find more information about `ubuntu_pro_config.*` variables on [Ubuntu Pro Client README](https://github.com/canonical/ubuntu-advantage-client#readme).
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
@@ -41,4 +55,4 @@ MIT / BSD
|
|||||||
|
|
||||||
## Author Information
|
## Author Information
|
||||||
|
|
||||||
This role was created in October 2022 by [Sebastien Thebert](https://github.com/sebthebert).
|
This role was created in October 2022 by [Sebastien Thebert](https://github.com/sebthebert).
|
||||||
@@ -11,3 +11,61 @@ argument_specs:
|
|||||||
- Ubuntu Pro token
|
- Ubuntu Pro token
|
||||||
type: str
|
type: str
|
||||||
required: true
|
required: true
|
||||||
|
ubuntu_pro_config.http_proxy:
|
||||||
|
description:
|
||||||
|
- HTTP Proxy
|
||||||
|
type: str
|
||||||
|
required: false
|
||||||
|
ubuntu_pro_config.https_proxy:
|
||||||
|
description:
|
||||||
|
- HTTPW Proxy
|
||||||
|
type: str
|
||||||
|
required: false
|
||||||
|
ubuntu_pro_config.apt_http_proxy:
|
||||||
|
description:
|
||||||
|
- apt HTTP Proxy
|
||||||
|
type: str
|
||||||
|
required: false
|
||||||
|
ubuntu_pro_config.apt_https_proxy:
|
||||||
|
description:
|
||||||
|
- apt HTTPs Proxy
|
||||||
|
type: str
|
||||||
|
required: false
|
||||||
|
ubuntu_pro_config.ua_apt_http_proxy:
|
||||||
|
description:
|
||||||
|
- ua apt HTTP Proxy
|
||||||
|
type: str
|
||||||
|
required: false
|
||||||
|
ubuntu_pro_config.ua_apt_https_proxy:
|
||||||
|
description:
|
||||||
|
- ua apt HTTPS Proxy
|
||||||
|
type: str
|
||||||
|
required: false
|
||||||
|
ubuntu_pro_config.global_apt_http_proxy:
|
||||||
|
description:
|
||||||
|
- global apt HTTP Proxy
|
||||||
|
type: str
|
||||||
|
required: false
|
||||||
|
ubuntu_pro_config.global_apt_https_proxy:
|
||||||
|
description:
|
||||||
|
- global apt HTTPS Proxy
|
||||||
|
type: str
|
||||||
|
required: false
|
||||||
|
ubuntu_pro_config.update_messaging_timer:
|
||||||
|
description:
|
||||||
|
- Update Messaging timer
|
||||||
|
type: int
|
||||||
|
required: false
|
||||||
|
default: 21600
|
||||||
|
ubuntu_pro_config.update_status_timer:
|
||||||
|
description:
|
||||||
|
- Update Status timer
|
||||||
|
type: int
|
||||||
|
required: false
|
||||||
|
default: 43200
|
||||||
|
ubuntu_pro_config.metering_timer:
|
||||||
|
description:
|
||||||
|
- Metering timer
|
||||||
|
type: int
|
||||||
|
required: false
|
||||||
|
default: 43200
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
- name: Configure proxies & timers for 'pro' client
|
||||||
|
ansible.builtin.command: "pro config {{ ('set ' + item.key + '=' + item.value if item.value else 'unset ' + item.key) }}"
|
||||||
|
loop: "{{ ubuntu_pro_config | dict2items }}"
|
||||||
|
when: ubuntu_pro_config is defined
|
||||||
|
become: yes
|
||||||
@@ -11,6 +11,14 @@
|
|||||||
upgrade: yes
|
upgrade: yes
|
||||||
become: yes
|
become: yes
|
||||||
|
|
||||||
|
- name: Install 'ubuntu-advantage-tools' package
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name: ubuntu-advantage-tools
|
||||||
|
state: latest
|
||||||
|
become: yes
|
||||||
|
|
||||||
|
- include_tasks: configure.yml
|
||||||
|
|
||||||
- name: Register this host on Ubuntu Pro (pro attach <token>)
|
- name: Register this host on Ubuntu Pro (pro attach <token>)
|
||||||
ansible.builtin.command: "pro attach {{ ubuntu_pro_token }}"
|
ansible.builtin.command: "pro attach {{ ubuntu_pro_token }}"
|
||||||
become: yes
|
become: yes
|
||||||
|
|||||||
@@ -4,3 +4,24 @@ ubuntu_pro_lts_releases:
|
|||||||
- "18.04"
|
- "18.04"
|
||||||
- "20.04"
|
- "20.04"
|
||||||
- "22.04"
|
- "22.04"
|
||||||
|
|
||||||
|
# ubuntu_pro_config:
|
||||||
|
# http_proxy:
|
||||||
|
# https_proxy:
|
||||||
|
# apt_http_proxy:
|
||||||
|
# apt_https_proxy:
|
||||||
|
# ua_apt_http_proxy:
|
||||||
|
# ua_apt_https_proxy:
|
||||||
|
# global_apt_http_proxy:
|
||||||
|
# global_apt_https_proxy:
|
||||||
|
# update_messaging_timer: 21600
|
||||||
|
# update_status_timer: 43200
|
||||||
|
# metering_timer: 14400
|
||||||
|
|
||||||
|
# ubuntu_pro_services:
|
||||||
|
# - 'cc-eal' # Common Criteria EAL2
|
||||||
|
# - 'esm-infra' # Expanded Security Maintenance for Infrastructure
|
||||||
|
# - 'fips'
|
||||||
|
# - 'fips-updates'
|
||||||
|
# - 'livepatch' # Canonical Kernel Livepatch
|
||||||
|
# - 'usg' # Ubuntu Security Guide
|
||||||
Reference in new issue
Block a user