Ansible

Ansible is a software that automates software provisioning, configuration management, and application deployment.

Snippets

Looping over a subelement

Variables:

users:
  - username: myles
    shell: /bin/bash
    authorized_keys:
      - "{{ lookup('file', 'ssh_keys/myles_laptop.pub') }}"
      - "{{ lookup('file', 'ssh_keys/myles_ipad.pub') }}"
      - "{{ lookup('file', 'ssh_keys/myles_iphone.pub') }}"

Tasks:

- name: add ~/.ssh/authorized_keys file for the user accounts
  authorized_key:
    user: '{{ item.0.username }}'
    key: "{{ item.1 }}"
  with_subelements:
    - '{{ users }}'
    - authorized_keys
  tags:
    - common
    - users

results matching ""

    powered by

    No results matching ""