As a example we would want to do the following for our initial builds on our servers or desktop fleet but this list can be modified to your business needs.

Provision new server

  • install all operating system updates
  • add ansible user
  • install core apps depending on the purpose of the server

Here is example code of installing all operating system updates

---
- hosts: all
  become: true
  tasks:

  - name: update repository index CentOS
    tags: always
    dnf:
     update_only: yes
     update_cache: yes
    when: ansible_distribution == 'CentOS'

  - name: update repository index Ubuntu
    tags: always
    apt:
     upgrade: dist
     update_cache: yes
    when: ansible_distribution == 'Ubuntu'

By Kad

Leave a Reply

Your email address will not be published. Required fields are marked *