Skip to content

Commit 4ba05c9

Browse files
committed
replace centos with ubuntu
1 parent a20c78d commit 4ba05c9

File tree

4 files changed

+26
-71
lines changed

4 files changed

+26
-71
lines changed

articles/ansible/dynamic-inventory-configure.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ In this article, you learn how to:
7474
az vm create \
7575
--resource-group ansible-inventory-test-rg \
7676
--name linux-vm \
77-
--image CentOS85Gen2 \
77+
--image Ubuntu2204 \
7878
--admin-username azureuser \
7979
--admin-password <password>
8080
```
@@ -98,7 +98,7 @@ In this article, you learn how to:
9898
New-AzVM `
9999
-ResourceGroupName ansible-inventory-test-rg `
100100
-Location eastus `
101-
-Image CentOS85Gen2 `
101+
-Image Ubuntu2204 `
102102
-Name linux-vm `
103103
-OpenPorts 22 `
104104
-Credential $credential
@@ -195,9 +195,9 @@ ansible-inventory -i myazure_rm.yml --list
195195
"default_inventory_hostname": "linux-vm_cdb4",
196196
"id": "/subscriptions/<subscriptionid>/resourceGroups/ansible-inventory-test-rg/providers/Microsoft.Compute/virtualMachines/linux-vm",
197197
"image": {
198-
"offer": "CentOS",
199-
"publisher": "OpenLogic",
200-
"sku": "7.7",
198+
"offer": "0001-com-ubuntu-server-jammy",
199+
"publisher": "Canonical",
200+
"sku": "22_04-lts-gen2",
201201
"version": "latest"
202202
},
203203
...,
@@ -247,7 +247,7 @@ include_vm_resource_groups:
247247
- ansible-inventory-test-rg
248248
auth_source: auto
249249
conditional_groups:
250-
linux: "'CentOS' in image.offer"
250+
linux: "'ubuntu' in image.offer"
251251
windows: "'WindowsServer' in image.offer"
252252
```
253253

@@ -283,7 +283,7 @@ include_vm_resource_groups:
283283
- ansible-inventory-test-rg
284284
auth_source: auto
285285
conditional_groups:
286-
linux: "'CentOS' in image.offer"
286+
linux: "'ubuntu' in image.offer"
287287
windows: "'WindowsServer' in image.offer"
288288
keyed_groups:
289289
- key: tags.applicationRole

articles/ansible/install-on-linux-vm.md

+16-55
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ ms.custom: devx-track-ansible, devx-track-azurecli, devx-track-azurepowershell,
1212
> [!CAUTION]
1313
> This article references CentOS, a Linux distribution that is nearing End Of Life (EOL) status. Please consider your use and plan accordingly. For more information, see the [CentOS End Of Life guidance](/azure/virtual-machines/workloads/centos/centos-end-of-life).
1414
15-
This article shows how to install [Ansible](https://docs.ansible.com/) on a Centos VM in Azure.
15+
This article shows how to install [Ansible](https://docs.ansible.com/) on an Ubuntu VM in Azure.
1616

1717
In this article, you learn how to:
1818

1919
> [!div class="checklist"]
2020
> * Create a resource group
21-
> * Create a CentOS virtual machine
21+
> * Create an Ubuntu virtual machine
2222
> * Install Ansible on the virtual machine
2323
> * Connect to the virtual machine via SSH
2424
> * Configure Ansible on the virtual machine
@@ -58,7 +58,7 @@ In this article, you learn how to:
5858
az vm create \
5959
--resource-group QuickstartAnsible-rg \
6060
--name QuickstartAnsible-vm \
61-
--image CentOS85Gen2 \
61+
--image Ubuntu2204 \
6262
--admin-username azureuser \
6363
--admin-password <password>
6464
```
@@ -75,7 +75,7 @@ In this article, you learn how to:
7575
New-AzVM `
7676
-ResourceGroupName QuickstartAnsible-rg `
7777
-Location eastus `
78-
-Image CentOS85Gen2 `
78+
-Image Ubuntu2204 `
7979
-Name QuickstartAnsible-vm `
8080
-OpenPorts 22 `
8181
-Credential $credential
@@ -109,50 +109,26 @@ Replace the `<vm_ip_address>` with the appropriate value returned in previous co
109109

110110
## Install Ansible on the virtual machine
111111

112-
### Ansible 2.9 with the azure_rm module
112+
### Ansible with azure.azcollection
113113

114-
Run the following commands to configure Ansible 2.9 on Centos:
114+
Run the following commands to configure Ansible on [Ubuntu](https://docs.ansible.com/ansible/latest/installation_guide/installation_distros.html#installing-ansible-on-ubuntu):
115115

116116
```bash
117117
#!/bin/bash
118118

119-
# Update all packages that have available updates.
120-
sudo yum update -y
119+
sudo apt update
121120

122-
# Install Python 3 and pip.
123-
sudo yum install -y python3-pip
121+
sudo apt install software-properties-common
124122

125-
# Upgrade pip3.
126-
sudo pip3 install --upgrade pip
123+
sudo add-apt-repository --yes --update ppa:ansible/ansible
127124

128-
# Install Ansible.
129-
pip3 install "ansible==2.9.17"
125+
sudo apt install ansible
130126

131-
# Install Ansible azure_rm module for interacting with Azure.
132-
pip3 install ansible[azure]
133-
```
134-
135-
### Ansible 2.10 with azure.azcollection
136-
137-
Run the following commands to configure Ansible on Centos:
138-
139-
```bash
140-
#!/bin/bash
127+
# Install Ansible az collection for interacting with Azure. (optional)
128+
ansible-galaxy collection install azure.azcollection --force
141129

142-
# Update all packages that have available updates.
143-
sudo yum update -y
144-
145-
# Install Python 3 and pip.
146-
sudo yum install -y python3-pip
147-
148-
# Upgrade pip3.
149-
sudo pip3 install --upgrade pip
150-
151-
# Install Ansible az collection for interacting with Azure.
152-
ansible-galaxy collection install azure.azcollection
153-
154-
# Install Ansible modules for Azure
155-
sudo pip3 install -r ~/.ansible/collections/ansible_collections/azure/azcollection/requirements-azure.txt
130+
# Install Ansible modules for Azure (optional)
131+
sudo pip3 install -r ~/.ansible/collections/ansible_collections/azure/azcollection/requirements.txt
156132
```
157133

158134
**Key points**:
@@ -219,10 +195,8 @@ This section shows how to create a test resource group within your new Ansible c
219195
Run the following ad-hoc Ansible command to create a resource group:
220196
221197
```bash
222-
#Ansible 2.9 with azure_rm module
223-
ansible localhost -m azure_rm_resourcegroup -a "name=ansible-test location=eastus"
224198
225-
#Ansible 2.10 with azure.azcollection
199+
#Ansible with azure.azcollection
226200
ansible localhost -m azure.azcollection.azure_rm_resourcegroup -a "name=<resource_group_name> location=<location>"
227201
```
228202
@@ -232,20 +206,7 @@ Replace `<resource_group_name>` and `<location>` with your values.
232206
233207
1. Save the following code as `create_rg.yml`.
234208
235-
Ansible 2.9 with azure_rm module
236-
237-
```yml
238-
---
239-
- hosts: localhost
240-
connection: local
241-
tasks:
242-
- name: Creating resource group
243-
azure_rm_resourcegroup:
244-
name: "<resource_group_name"
245-
location: "<location>"
246-
```
247-
248-
Ansible 2.10 with azure.azcollection
209+
Ansible with azure.azcollection
249210
250211
```yml
251212
- hosts: localhost

articles/ansible/vm-configure.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ In this article, you learn how to:
106106
key_data: "<key_data>"
107107
network_interfaces: myNIC
108108
image:
109-
offer: CentOS
110-
publisher: OpenLogic
111-
sku: '7.5'
109+
offer: 0001-com-ubuntu-server-jammy
110+
publisher: Canonical
111+
sku: 22_04-lts
112112
version: latest
113113
```
114114

articles/ansible/vm-scale-set-deploy-app.md

-6
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,6 @@ Before running the playbook, see the following notes:
169169
apt-get install sshpass
170170
```
171171

172-
CentOS:
173-
174-
```bash
175-
yum install sshpass
176-
```
177-
178172
* In some environments, you may see an error about using an SSH password instead of a key. If you do receive that error, you can disable host key checking by adding the following line to `/etc/ansible/ansible.cfg` or `~/.ansible.cfg`:
179173

180174
```bash

0 commit comments

Comments
 (0)