Updated host prep tasks
Change so that local ssh is no longer assumed to be available. The tasks for keyfile generation and insertion as root are now done in the same place. When running on an APT systems the backports repo will be made available if its found within the sources list file. Change-Id: I9c16378cee3862cd8ce2d87e8c5483533f98c94d Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
parent
c130bdd1de
commit
7bccc59c6e
|
@ -13,6 +13,13 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# The "command" module is used here instead of "lineinfile" because all we
|
||||
# want to do is uncomment the backports repo if its found.
|
||||
- name: Ensure trusty-backports are available
|
||||
command: "sed -i '/deb.*-backports/s|^#\\s||g' /etc/apt/sources.list"
|
||||
when:
|
||||
- ansible_pkg_mgr == 'apt'
|
||||
|
||||
- name: First ensure apt cache is always refreshed
|
||||
apt:
|
||||
update_cache: true
|
||||
|
|
|
@ -20,11 +20,6 @@
|
|||
- include: "common-tasks/test-set-nodepool-vars.yml"
|
||||
- name: Clear iptables rules
|
||||
shell: "{{ playbook_dir }}/iptables-clear.sh"
|
||||
- name: Ensure roots new public ssh key is in authorized_keys
|
||||
authorized_key:
|
||||
user: root
|
||||
key: "{{ hostvars['localhost']['lxc_container_ssh_key'] }}"
|
||||
manage_dir: no
|
||||
- set_fact:
|
||||
lxc_container_ssh_key: "{{ hostvars['localhost']['lxc_container_ssh_key'] }}"
|
||||
roles:
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
# inventory
|
||||
- name: Playbook for establishing ssh keys
|
||||
hosts: localhost
|
||||
connection: local
|
||||
gather_facts: false
|
||||
become_user: root
|
||||
tasks:
|
||||
- name: Create ssh key pair for root
|
||||
|
@ -31,3 +33,7 @@
|
|||
register: key_get
|
||||
- set_fact:
|
||||
lxc_container_ssh_key: "{{ key_get.stdout }}"
|
||||
- name: Ensure root can ssh to localhost
|
||||
authorized_key:
|
||||
user: "root"
|
||||
key: "{{ lxc_container_ssh_key }}"
|
||||
|
|
Loading…
Reference in New Issue