Enable cockpit, initially Fedora 33 with others later

This commit is contained in:
Jason Rothstein 2020-11-29 23:21:17 -06:00
parent 3ba4bbfaef
commit f48ff23d7c
5 changed files with 100 additions and 7 deletions

View File

@ -1,7 +1,7 @@
Role Name
=========
A brief description of the role goes here.
Ensures cockpit is running
Requirements
------------
@ -30,7 +30,7 @@ Including an example of how to use your role (for instance, with variables passe
License
-------
BSD
LGPL-3.0-or-later
Author Information
------------------

View File

@ -1,6 +1,6 @@
galaxy_info:
author: your name
description: your role description
author: Jason Rothstein
description: Ensures cockpit is installed, running, and functional
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
@ -14,7 +14,7 @@ galaxy_info:
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)
license: LGPL-3.0-or-later
min_ansible_version: 2.9
@ -50,4 +50,4 @@ galaxy_info:
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

View File

@ -1,2 +1,61 @@
---
# tasks file for ensure_cockpit
# tasks file for ensure_cockpit
- name: 'include variables'
when:
- ansible_system == 'Linux'
include_vars:
file: '{{ lookup("first_found", findme ) }}'
name: 'ensure_cockpit'
vars:
findme:
files:
- '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}.yml'
- '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}-default.yml'
- '{{ ansible_distribution }}-default.yml'
- '{{ ansible_os_family }}-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}.yml'
- '{{ ansible_os_family }}-{{ ansible_distribution_major_version }}-default.yml'
- '{{ ansible_os_family }}-default.yml'
- 'default.yml'
paths:
- '../vars/'
errors: 'ignore'
- name: 'package discovery'
when:
- ansible_system == 'Linux'
- packages is not defined
ansible.builtin.package_facts:
- name: 'ensure packages'
when:
- ansible_system == 'Linux'
- ensure_cockpit is defined
- ensure_cockpit.package_list is defined
- ensure_cockpit.package_list is iterable
- packages[item.name] is not defined
ansible.builtin.package:
name: '{{ item.name }}'
state: '{{ item.state }}'
loop: '{{ ensure_cockpit.package_list }}'
loop_control:
label: '{{ item.name }} will be {{ item.state }}'
notify:
- 'ensure_cockpit.package_facts'
- 'ensure_cockpit.service_facts'
- name: 'ensure services'
when:
- ansible_system == 'Linux'
- ensure_cockpit is defined
- ensure_cockpit.service_list is defined
- ensure_cockpit.service_list is iterable
ansible.builtin.service:
enabled: '{{ item.enabled }}'
name: '{{ item.name }}'
state: '{{ item.state }}'
loop: '{{ ensure_cockpit.service_list }}'
loop_control:
label: '{{ item.name }} will be {{ item.state }}'
notify:
- 'ensure_cockpit.package_facts'
- 'ensure_cockpit.service_facts'
- name: 'flush handlers'
meta: 'flush_handlers'

32
vars/Fedora-33.yml Normal file
View File

@ -0,0 +1,32 @@
---
# vars file for ensure_cockpit
package_list:
- name: 'cockpit'
state: 'present'
- name: 'cockpit-bridge'
state: 'present'
- name: 'cockpit-dashboard'
state: 'present'
- name: 'cockpit-doc'
state: 'present'
- name: 'cockpit-kdump'
state: 'present'
- name: 'cockpit-networkmanager'
state: 'present'
- name: 'cockpit-packagekit'
state: 'present'
- name: 'cockpit-pcp'
state: 'present'
- name: 'cockpit-selinux'
state: 'present'
- name: 'cockpit-storaged'
state: 'present'
- name: 'cockpit-system'
state: 'present'
- name: 'cockpit-ws'
state: 'present'
service_list:
- name: 'cockpit.socket'
state: 'started'
enabled: 'yes'

2
vars/default.yml Normal file
View File

@ -0,0 +1,2 @@
---
# vars file for ensure_cockpit