Ansible

How to deploy encrypted copies of your SSL keys and other files with Ansible and OpenSSL | Calazan.com

ansible-vault encrypt_string --ask-vault-pass --stdin-name 'ansible_password'

https://everythingshouldbevirtual.com/automation/ansible-using-yaml-for-inventory/

Copy file to host, set local ACL, remove inherited ACLs

  1. Copy over private key also creating .ssh folder in the process (note use of \ at end of dest)
  2. Set local permissions on .ssh to FullControl for user kermit
  3. Remove parent permission inheritance on .ssh folder

All files and folders under .ssh should inherit permission of .ssh

- hosts: laptops
  tasks:
  - name: Copy keys to access hamburger
    win_copy:
      src: ./to_hamburger_server_2019
      dest: C:\tools\cygwin\home\kermit\.ssh\
      decrypt: yes
  - name: Set local ACL for kermit on .ssh folder
    win_acl:
      user: kermit
      path: C:\tools\cygwin\home\kermit\.ssh
      type: allow
      state: present
      rights: FullControl
  - name: Disable inherited permissions on .ssh folder (aka parent permissions)
    win_acl_inheritance:
      path: C:\tools\cygwin\home\kermit\.ssh
      state: absent
  - name: Copy keys to access hamburger
    win_copy:
      src: ./to_hamburger_server_2019.pub
      dest: C:\tools\cygwin\home\kermit\.ssh\
ansible – using ansible vault with copy module to decrypt on-the-fly files | Any IT here? Help Me!
Admin? Anyone? Let’s say Anyhelp is appreciated!