diff --git a/README.md b/README.md index 070e554..ae5cdee 100644 --- a/README.md +++ b/README.md @@ -6,3 +6,14 @@ Instructions 3. Run ``cp infra_config.yml.sample infra_config.yml`` 4. Edit infra_config.yml and put your environment values 5. Run ``bash run.sh`` + +Notes +===== + +In infra_config.yml you may specify public key file instead of public key content, in the following way: + + keypairs: + - name: my_key_file + public_key_file: /home//.ssh/ + +Do not specify both 'public_key' and 'public_key_file', as they are mutual exclusive variables in Ansible. diff --git a/infra_config.yml.sample b/infra_config.yml.sample index 945b044..9172cfb 100644 --- a/infra_config.yml.sample +++ b/infra_config.yml.sample @@ -1,8 +1,11 @@ --- os_client_config_cloud: envvars system_config_repo_url: git@your_git_server/system-config.git -key_name: your_openstack_key +key_name: your_openstack_key_name domainname: yourdomain +keypairs: + - name: my_key_name + public_key: my_public_key_content infra_servers: - name: puppetmaster image: 9d25fe2d-cf31-4b05-8c58-f238ec78e633 diff --git a/roles/setup_openstack_resources/tasks/main.yml b/roles/setup_openstack_resources/tasks/main.yml index 5edc953..163f23e 100644 --- a/roles/setup_openstack_resources/tasks/main.yml +++ b/roles/setup_openstack_resources/tasks/main.yml @@ -2,9 +2,10 @@ - name: Create keypairs os_keypair: state: present - cloud: "{{item.os_client_config_cloud | default(os_client_config_cloud) }}" - name: "{{ item.name }}" - public_key: "{{ item.contents }}" + cloud: "{{ item.os_client_config_cloud | default(os_client_config_cloud) }}" + name: "{{ item.name | default(key_name) }}" + public_key: "{{ item.public_key | default(omit) }}" + public_key_file: "{{ item.public_key_file | default(omit) }}" validate_certs: "{{ os_validate_certs }}" with_items: keypairs