diff --git a/roles/aws/aws_ec2_with_eip/templates/user-data-debian.sh.j2 b/roles/aws/aws_ec2_with_eip/templates/user-data-debian.sh.j2 index 09db4ab09..e95d44f3c 100644 --- a/roles/aws/aws_ec2_with_eip/templates/user-data-debian.sh.j2 +++ b/roles/aws/aws_ec2_with_eip/templates/user-data-debian.sh.j2 @@ -17,3 +17,9 @@ CONTROLLER_PUBKEY="{{ aws_ec2_with_eip.pubkey }}" /usr/bin/echo "$CONTROLLER_USER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/"$CONTROLLER_USER" /usr/bin/chmod 0440 /etc/sudoers.d/"$CONTROLLER_USER" /usr/bin/echo "$CONTROLLER_PUBKEY" >> /home/"$CONTROLLER_USER"/.ssh/authorized_keys + +# Install Ansible +/usr/bin/apt-get install -y -o Dpkg::Options::="--force-confnew" python3-venv python3-debian +/usr/bin/su - "$CONTROLLER_USER" -c "/usr/bin/python3 -m venv /home/$CONTROLLER_USER/ce-python" +/usr/bin/su - "$CONTROLLER_USER" -c "/home/$CONTROLLER_USER/ce-python/bin/python3 -m pip install --upgrade pip" +/usr/bin/su - "$CONTROLLER_USER" -c "/home/$CONTROLLER_USER/ce-python/bin/pip install ansible netaddr python-debian"