How to do it...

  1. We will be using the IAM module to create IAM users. In the following task, we will be creating an IAM user. We will also set a password for the user being created. We will be storing this information in our secrets.yml, which is protected by Ansible Vault. We have discussed Ansible vault in the Chapter 1, Getting Started with Ansible and Cloud Management, and in Chapter 2, Using Ansible to Manage AWS EC2:
- name: Create IAM users  iam:    iam_type: user    name: "{{ item }}"    state: present    password: "{{ iam_pass }}"  with_items:    - cookbook-admin    - cookbook-two 
  tags: 
    - recipe5 
  1. Let's first create a JSON policy for providing access to all AWS resources in the AWS account. Note that we are only giving this policy as an example; we ...

Get Ansible 2 Cloud Automation Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.