#vim: set ft=ansible: --- # tasks file for bastion ######################### Setting up environment for post deployment administration - name: create /root/.ssh file: dest: /root/.ssh mode: 0700 state: directory - name: copy the environment .pem key become: true copy: src: "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}" dest: /root/.ssh/{{env_authorized_key}}.pem owner: root group: root mode: 0400 when: use_own_key|bool - name: copy the user's SSH private key become: true copy: src: "~/.ssh/{{key_name}}.pem" dest: "/root/.ssh/{{key_name}}.pem" owner: root group: root mode: 0400 when: not use_own_key|bool tags: - copy_env_private_key - name: Generate host .ssh/config Template become: no local_action: template src={{ role_path }}/files/bastion_ssh_config.j2 dest={{ ANSIBLE_REPO_PATH }}/workdir/ssh-config-{{ env_type }}-{{ guid }} tags: - gen_sshconfig_file - name: copy over host .ssh/config Template become: true copy: src: "{{ ANSIBLE_REPO_PATH }}/workdir/ssh-config-{{ env_type }}-{{ guid }}" dest: /root/.ssh/config owner: root group: root mode: 0400 tags: - copy_sshconfig_file - name: Install python2-winrm and python-requests ignore_errors: yes become: true yum: name: "{{ item }}" with_items: - python2-winrm - python-requests - name: Try to install mosh (we love it) become: true yum: name: http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/m/mosh-1.3.0-1.el7.x86_64.rpm ignore_errors: yes