Saturday, September 14, 2019

Postinstall tasks for Fedora using Ansible

Fedora Ansible tasks repo - various tasks

https://docs.fedoraproject.org/en-US/quick-docs/adding-or-removing-software-repositories-in-fedora/



https://github.com/fabaff/fedora-ansible

Code for example below
https://github.com/dveselka/devops-ansible/tree/master/fedora-postinstall

Create Ansible playbook

[dave@dave fedora-ansible-postinstall]$ find
.
./post_install.yml
./tasks
./tasks/rpmfusion.yml



---
- hosts: localhost
  become: yes
  vars:
    fedora_current: 30
  tasks:
    - include: tasks/rpmfusion.yml

Enable RPMFusion repository

---
- name: install the rpmfusion repo packages
  dnf:
    name: ['http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-{{ fedora_current }}.noarch.rpm', 
'http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-{{ fedora_current }}.noarch.rpm']
    state: present

Run Ansible playbook

sudo ansible-playbook post_install.yml -vv
Added Google Chrome installation task
sudo ansible-playbook post_install.yml 
 [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'


PLAY [localhost] ********************************************************************************************************************************************************

TASK [Gathering Facts] **************************************************************************************************************************************************
ok: [localhost]

TASK [install the rpmfusion repo packages] ******************************************************************************************************************************
ok: [localhost]

TASK [install Fedora Workstation repositories] **************************************************************************************************************************
ok: [localhost]

TASK [install Google Chrome] ********************************************************************************************************************************************
ok: [localhost]

PLAY RECAP **************************************************************************************************************************************************************
localhost                  : ok=4    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

No comments:

Post a Comment