0

Ansible roles for a common sensible base configuration for all machines. Should support RHEL/Debian/SuSE/Solaris/HPUX/Ubuntu Linux.

The Base host configuration should perform the following tasks:

  • ntp – configure NTP settings based on common configuration
  • ssh – configure SSH security, service, key settings
  • Package Yum / repo – configure Operating System native package manager to operate against internal HPE resources and/or externally-available resources (like ftp.debian.org).

I am new to creating Ansible Roles. I haven't tried anything yet, looking for guidance.

- name: restart ntp
  service:
    name: ntp
    state: restarted
- name: restart sshd
  service:
    name: sshd
    state: restarted
Vladimir Botka
  • 58,131
  • 4
  • 32
  • 63
  • 2
    It's pretty well documented in ansibles documentation how to write a role. https://galaxy.ansible.com/docs/finding/content_types.html#ansible-roles – Toerktumlare May 22 '19 at 13:07
  • Welcome to StackOverflow! If you have questions, please follow [How to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve). – Vladimir Botka May 22 '19 at 13:35
  • Thank you Vladimir –  May 22 '19 at 13:47
  • @Keith: StackOverflow is kind of specific in how to comment. With all respect, please have a look at the Help Center: [do not add a comment on your question or on an answer to say "Thank you".](https://stackoverflow.com/help/someone-answers). – Vladimir Botka May 22 '19 at 13:51
  • Some details are also available in accepted and upvoted SO question [How to create ansible galaxy roles in windows?](https://stackoverflow.com/questions/46781461/how-to-create-ansible-galaxy-roles-in-windows). – Vladimir Botka May 22 '19 at 13:58

1 Answers1

1

To create your own role start with

$ ansible-galaxy init test

This "creates the skeleton framework of a role that complies with the galaxy metadata format"

> tree test
test
├── defaults
│   └── main.yml
├── files
├── handlers
│   └── main.yml
├── meta
│   └── main.yml
├── README.md
├── tasks
│   └── main.yml
├── templates
├── tests
│   ├── inventory
│   └── test.yml
└── vars
    └── main.yml

For details see Roles.

There is plenty of roles shared at Ansible Galaxy that you might want to search in the browser, or from the command line. For example roles with tags: Solaris, sshd will be listed by the command

$ ansible-galaxy search --galaxy-tags solaris,sshd

and installed locally

$ ansible-galaxy install <ROLE NAME>
Vladimir Botka
  • 58,131
  • 4
  • 32
  • 63