Skip to content

Commit

Permalink
Use the password plug-in to generate a login key (#1699)
Browse files Browse the repository at this point in the history
* Use the password plug-in to generate a login key

* small change
  • Loading branch information
Fred-sun authored Sep 3, 2024
1 parent 97620f0 commit 76cea6c
Show file tree
Hide file tree
Showing 29 changed files with 103 additions and 86 deletions.
4 changes: 2 additions & 2 deletions plugins/modules/azure_rm_appgateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,7 @@
policy_name: "ssl_policy20170401_s"
ssl_certificates:
- name: ssl_cert
password: your-password
password: "{{ password }}"
data: "{{ lookup('file', 'certfile') }}"
gateway_ip_configurations:
- subnet:
Expand Down Expand Up @@ -1248,7 +1248,7 @@
policy_name: ssl_policy20170401_s
ssl_certificates:
- name: ssl_cert
password: your-password
password: "{{ password }}"
data: "{{ lookup('file', ssl_cert) }}"
gateway_ip_configurations:
- subnet:
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/azure_rm_devtestlabvirtualmachine.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
os_type: linux
vm_size: Standard_A2_v2
user_name: vmadmin
password: ZSuppas$$21!
password: "{{ password }}"
lab_subnet:
name: myvnSubnet
virtual_network_name: myvn
Expand Down
6 changes: 3 additions & 3 deletions plugins/modules/azure_rm_hdinsightcluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
cluster_definition:
kind: spark
gateway_rest_username: http-user
gateway_rest_password: MuABCPassword!!@123
gateway_rest_password: "{{ password }}"
storage_accounts:
- name: myStorageAccount.blob.core.windows.net
is_default: true
Expand All @@ -174,13 +174,13 @@
vm_size: Standard_D3
linux_profile:
username: sshuser
password: MuABCPassword!!@123
password: "{{ password }}"
- name: workernode
target_instance_count: 2
vm_size: Standard_D3
linux_profile:
username: sshuser
password: MuABCPassword!!@123
password: "{{ password }}"
'''

RETURN = '''
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/azure_rm_mariadbserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
enforce_ssl: true
version: 10.2
admin_username: cloudsa
admin_password: password
admin_password: "{{ password }}"
'''

RETURN = '''
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/azure_rm_mysqlserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
enforce_ssl: true
version: 5.7
admin_username: cloudsa
admin_password: password
admin_password: "{{ password }}"
'''

RETURN = '''
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/azure_rm_postgresqlflexibleserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@
name: Standard_B1ms
tier: Burstable
administrator_login: azureuser
administrator_login_password: Fred@0329
administrator_login_password: "{{ password }}"
version: 12
storage:
storage_size_gb: 128
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/azure_rm_postgresqlserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
enforce_ssl: true
storage_autogrow: true
admin_username: cloudsa
admin_password: password
admin_password: "{{ password }}"
'''

RETURN = '''
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/azure_rm_sqlmanagedinstance.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@
identity:
type: SystemAssigned
administrator_login: azureuser
administrator_login_password: Ft@password0329test
administrator_login_password: "{{ password }}"
storage_size_in_gb: 256
v_cores: 8
Expand Down
6 changes: 3 additions & 3 deletions plugins/modules/azure_rm_sqlserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,14 @@
name: server_name
location: westus
admin_username: mylogin
admin_password: Testpasswordxyz12!
admin_password: "{{ password }}"
- name: Change SQL Server admin password
azure_rm_sqlserver:
resource_group: myResourceGroup
name: server_name
location: westus
admin_password: NewPasswordx123!
admin_password: "{{ password }}"
change_admin_password: true
- name: Create SQL Server with Azure Active Directory admin
Expand All @@ -172,7 +172,7 @@
name: server_name
location: westus
admin_username: mylogin
admin_password: Testpasswordxyz12!
admin_password: "{{ password }}"
administrators:
principal_type: Group
login: MySqlAdminGroup
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/azure_rm_webapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@
name: ansible/ubuntu1404
registry_server_url: myregistry.io
registry_server_user: user
registry_server_password: pass
registry_server_password: "{{ password }}"
- name: Create a multi-container web app
azure_rm_webapp:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
- name: Set display name variable
ansible.builtin.set_fact:
display_name: "test_app_{{ 999999999999999999994 | random | to_uuid }}"
password: "{{ lookup('ansible.builtin.password', '/dev/null', chars=['ascii_letters', 'digits', 'punctuation'], length=13) }}"
run_once: true

- name: Get full list from ad app info
Expand Down Expand Up @@ -40,7 +41,7 @@
description: "for app role test"
display_name: "{{ display_name }}_approle"
is_enabled: true
value: Password@0329
value: "{{ password }}"
optional_claims:
access_token_claims:
- name: aud
Expand Down
19 changes: 10 additions & 9 deletions tests/integration/targets/azure_rm_appgateway/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
- name: Gather Resource Group info
azure.azcollection.azure_rm_resourcegroup_info:
name: "{{ resource_group }}"
password: "{{ lookup('ansible.builtin.password', '/dev/null', chars=['ascii_letters', 'digits', 'punctuation'], length=12) }}"
register: __rg_info

- name: Prepare random number
Expand Down Expand Up @@ -82,7 +83,7 @@
policy_name: "ssl_policy20170401_s"
ssl_certificates:
- name: cert2
password: your-password
password: "{{ password }}"
data: "{{ lookup('file', cert2_file) }}"
gateway_ip_configurations:
- subnet:
Expand Down Expand Up @@ -237,7 +238,7 @@
policy_name: "ssl_policy20170401_s"
ssl_certificates:
- name: cert2
password: your-password
password: "{{ password }}"
data: "{{ lookup('file', cert2_file) }}"
gateway_ip_configurations:
- subnet:
Expand Down Expand Up @@ -392,7 +393,7 @@
policy_name: "ssl_policy20170401_s"
ssl_certificates:
- name: cert2
password: your-password
password: "{{ password }}"
data: "{{ lookup('file', cert2_file) }}"
gateway_ip_configurations:
- subnet:
Expand Down Expand Up @@ -550,7 +551,7 @@
policy_name: "ssl_policy20170401_s"
ssl_certificates:
- name: cert2
password: your-password
password: "{{ password }}"
data: "{{ lookup('file', cert2_file) }}"
gateway_ip_configurations:
- subnet:
Expand Down Expand Up @@ -713,7 +714,7 @@
policy_name: "ssl_policy20170401_s"
ssl_certificates:
- name: cert2
password: your-password
password: "{{ password }}"
data: "{{ lookup('file', cert2_file) }}"
gateway_ip_configurations:
- subnet:
Expand Down Expand Up @@ -879,7 +880,7 @@
policy_name: "ssl_policy20170401_s"
ssl_certificates:
- name: cert2
password: your-password
password: "{{ password }}"
data: "{{ lookup('file', cert2_file) }}"
trusted_root_certificates:
- name: "rootCert3"
Expand Down Expand Up @@ -1047,7 +1048,7 @@
policy_name: "ssl_policy20170401_s"
ssl_certificates:
- name: cert2
password: your-password
password: "{{ password }}"
data: "{{ lookup('file', cert2_file) }}"
trusted_root_certificates:
- name: "rootCert3"
Expand Down Expand Up @@ -1218,7 +1219,7 @@
policy_name: "ssl_policy20170401_s"
ssl_certificates:
- name: cert2
password: your-password
password: "{{ password }}"
data: "{{ lookup('file', cert2_file) }}"
gateway_ip_configurations:
- subnet:
Expand Down Expand Up @@ -1382,7 +1383,7 @@
policy_name: "ssl_policy20170401_s"
ssl_certificates:
- name: cert2
password: your-password
password: "{{ password }}"
data: "{{ lookup('file', cert2_file) }}"
gateway_ip_configurations:
- subnet:
Expand Down
7 changes: 4 additions & 3 deletions tests/integration/targets/azure_rm_deployment/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
- name: Create random dns label
ansible.builtin.set_fact:
dns_label: "test{{ resource_group | hash('md5') | truncate(16, True, '') + (65535 | random | string) }}"
password: "{{ lookup('ansible.builtin.password', '/dev/null', chars=['ascii_letters', 'digits', 'punctuation'], length=12) }}"

- name: Error Create Azure Deploy
azure_rm_deployment:
Expand All @@ -12,7 +13,7 @@
adminUsername:
value: chouseknecht
adminPassword:
value: password123!
value: "{{ password }}"
dnsLabelPrefix:
value: "{{ dns_label }}"
ubuntuOSVersion:
Expand All @@ -30,7 +31,7 @@
adminUsername:
value: chouseknecht
adminPassword:
value: password123!
value: "{{ password }}"
dnsLabelPrefix:
value: "{{ dns_label }}"
ubuntuOSVersion:
Expand All @@ -42,7 +43,7 @@
hostname: "{{ item.vm_name }}"
ansible_host: "{{ item['ips'][0].public_ip }}"
ansible_user: chouseknecht
ansible_ssh_pass: password123!
ansible_ssh_pass: "{{ password }}"
groupname: azure_vms
with_items: "{{ output.deployment.instances }}"

Expand Down
3 changes: 2 additions & 1 deletion tests/integration/targets/azure_rm_devtestlab/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
- name: Set devtest labe value
ansible.builtin.set_fact:
rpfx: "{{ resource_group | hash('md5') | truncate(20, True, '') }}"
password: "{{ lookup('ansible.builtin.password', '/dev/null', chars=['ascii_letters', 'digits', 'punctuation'], length=13) }}"

- name: Create a DevTest Lab (check mode)
azure_rm_devtestlab:
Expand Down Expand Up @@ -90,7 +91,7 @@
os_type: linux
vm_size: Standard_A2_v2
user_name: azureuser
password: Password@0329
password: "{{ password }}"
lab_subnet:
name: "vnet-{{ rpfx }}Subnet"
virtual_network_name: "vnet-{{ rpfx }}"
Expand Down
Loading

0 comments on commit 76cea6c

Please sign in to comment.