|-- dev
|-- production
|-- group_vars/
| |-- all.yml
| |-- linux.yml
| |-- windows.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo apt-get install python -y | |
useradd -m -d /home/ansible -s /bin/bash ansible | |
echo 'ansible:P@ssw0rd'|chpasswd | |
echo 'ansible ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers | |
sudo sed -n 'H;${x;s/\PasswordAuthentication no/PasswordAuthentication yes/;p;}' /etc/ssh/sshd_config > tmp_sshd_config | |
sudo cat tmp_sshd_config > /etc/ssh/sshd_config | |
rm -f tmp_sshd_config | |
sudo service sshd restart |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TASK [run ping] **************************************************************************** | |
task path: /ansible/ping.yaml:20 | |
<34.202.122.113> ESTABLISH SSH CONNECTION FOR USER: ansible | |
<34.202.122.113> SSH: EXEC sshpass -d9 ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o 'User="ansible"' -o ConnectTimeout=10 -o StrictHostKeyChecking=no -o ControlPath=/root/.ansible/cp/65b11a12a7 34.202.122.113 '/bin/sh -c '"'"'echo ~ansible && sleep 0'"'"'' | |
<34.202.122.113> (3, '', 'sshpass: Failed to run command: No such file or directory\n') | |
<34.202.122.113> Failed to connect to the host via ssh: sshpass: Failed to run command: No such file or directory | |
<34.202.122.113> ESTABLISH SSH CONNECTION FOR USER: ansible | |
<34.202.122.113> SSH: EXEC sshpass -d9 ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o 'User="ansible"' -o ConnectTimeout=10 -o StrictHostKeyChecking=no -o ControlPath=/root/.ansible/cp/65b11a12a7 34.202.122.113 '/bin/sh -c '"'"'echo "`pwd`" && sleep 0'"'"'' | |
<34.202.122.113> (3, '', 'sshpass: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$credentials = New-Object Microsoft.Azure.Commands.ActiveDirectory.PSADPasswordCredential -Property @{ StartDate=Get-Date; EndDate=Get-Date -Year 2024; Password='<Password>'}; | |
$spSplat = @{ DisplayName = 'ansible' ; PasswordCredential = $credentials} ; | |
$sp = New-AzAdServicePrincipal @spSplat |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ! ansible-playbook -i hosts_azure_rm.yml site.yml --vault-password-file .vault; then | |
echo "Ansible failed!" | |
rm .vault | |
exit 1 | |
else | |
rm .vault | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$keyName = '{keyName}' | |
ssh-keygen -f $keyName -t rsa -N '""' -b 4096 -C '{email}' | |
$publicKey = (Get-Content "$keyName.pub" -Raw).ToString() | |
gh auth login | |
gh api "repos/{userName}/{repo}/keys" -f "key=$publicKey" -f "title=ROkey" -F read_only="true" |
Dockerfile
FROM centos:centos7
COPY requirements-azure /tmp
RUN yum check-update; \
yum install -y gcc libffi-devel python3 epel-release; \
yum install -y openssh-clients; \
curl https://packages.microsoft.com/config/rhel/7/prod.repo | tee /etc/yum.repos.d/microsoft.repo; \
yum install -y powershell; \
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Update all packages that have available updates. | |
sudo yum update -y | |
# Install Python 3 and pip. | |
sudo yum install -y python3-pip | |
# Upgrade pip3. | |
sudo pip3 install --upgrade pip |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM centos:centos7 | |
RUN yum check-update; \ | |
yum install -y gcc libffi-devel python3 epel-release; \ | |
yum install -y openssh-clients; \ | |
yum clean all; \ | |
yum install ansible -y; |