This commit is contained in:
53
ansible/windows/roles/cloudbase-init/tasks/main.yml
Normal file
53
ansible/windows/roles/cloudbase-init/tasks/main.yml
Normal file
@ -0,0 +1,53 @@
|
||||
# Copyright 2020 The Kubernetes Authors.
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
---
|
||||
- name: Download Cloudbase-init
|
||||
win_get_url:
|
||||
url: "{{ cloudbase_init_url }}"
|
||||
dest: '{{ tempdir.stdout | trim }}\CloudbaseInitSetup.msi'
|
||||
register: installer
|
||||
retries: 5
|
||||
delay: 3
|
||||
until: installer is not failed
|
||||
|
||||
- name: Ensure log directory
|
||||
win_file:
|
||||
path: '{{ systemdrive.stdout | trim }}\logs'
|
||||
state: directory
|
||||
|
||||
- name: Install Cloudbase-init
|
||||
win_package:
|
||||
path: '{{ installer.dest }}'
|
||||
log_path: '{{ systemdrive.stdout | trim }}\logs\cloudbase-install-log-{{lookup("pipe", "date +%Y%m%dT%H%M%S")}}.log'
|
||||
|
||||
# configuration modified from https://github.com/cloudbase/windows-openstack-imaging-tools/tree/master/Examples/config/azure
|
||||
- name: Set up cloudbase-init unattend configuration
|
||||
win_template:
|
||||
src: templates/cloudbase-init-unattend.conf
|
||||
dest: '{{ programfiles.stdout | trim }}\Cloudbase Solutions\Cloudbase-Init\conf\cloudbase-init-unattend.conf'
|
||||
|
||||
# configuration modified from https://github.com/cloudbase/windows-openstack-imaging-tools/tree/master/Examples/config/azure
|
||||
- name: Set up cloudbase-init configuration
|
||||
win_template:
|
||||
src: templates/cloudbase-init.conf
|
||||
dest: '{{ programfiles.stdout | trim }}\Cloudbase Solutions\Cloudbase-Init\conf\cloudbase-init.conf'
|
||||
|
||||
- name: Configure set up complete
|
||||
win_shell: |
|
||||
# If this file already exists then the following command fails
|
||||
Remove-Item -Force {{ systemdrive.stdout | trim }}\Windows\Setup\Scripts\SetupComplete.cmd
|
||||
& "{{ programfiles.stdout | trim }}\Cloudbase Solutions\Cloudbase-Init\bin\SetSetupComplete.cmd"
|
||||
become: yes
|
||||
become_method: runas
|
||||
become_user: System
|
@ -0,0 +1,28 @@
|
||||
[DEFAULT]
|
||||
# This configuration with SetUserPasswordPlugin and CreateUserPlugin will create a user capi
|
||||
# and generate a 123 charater random password. SSH can be configred on the machine to enable access.
|
||||
username=capi
|
||||
groups=Administrators
|
||||
inject_user_password=false
|
||||
user_password_length=123
|
||||
first_logon_behaviour=no
|
||||
|
||||
config_drive_raw_hhd=true
|
||||
config_drive_cdrom=true
|
||||
config_drive_vfat=true
|
||||
bsdtar_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\bin\bsdtar.exe
|
||||
mtools_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\bin\
|
||||
verbose=true
|
||||
debug=true
|
||||
logdir=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\log\
|
||||
logfile=cloudbase-init-unattend.log
|
||||
default_log_levels=comtypes=INFO,suds=INFO,iso8601=WARN,requests=WARN
|
||||
logging_serial_port_settings={{ cloudbase_logging_serial_port }}
|
||||
mtu_use_dhcp_config=true
|
||||
ntp_use_dhcp_config=true
|
||||
local_scripts_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\LocalScripts\
|
||||
metadata_services={{ cloudbase_metadata_services_unattend }}
|
||||
plugins={{ cloudbase_plugins_unattend }}
|
||||
allow_reboot=false
|
||||
stop_service_on_exit=false
|
||||
check_latest_version=false
|
@ -0,0 +1,36 @@
|
||||
[DEFAULT]
|
||||
# This configuration with SetUserPasswordPlugin and CreateUserPlugin will create a user capi
|
||||
# and generate a 123 charater random password. SSH can be configred on the machine to enable access.
|
||||
username=capi
|
||||
groups=Administrators
|
||||
inject_user_password=false
|
||||
user_password_length=123
|
||||
first_logon_behaviour=no
|
||||
rename_admin_user=true
|
||||
|
||||
config_drive_raw_hhd=true
|
||||
config_drive_cdrom=true
|
||||
config_drive_vfat=true
|
||||
bsdtar_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\bin\bsdtar.exe
|
||||
mtools_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\bin\
|
||||
verbose=true
|
||||
debug=true
|
||||
logdir=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\log\
|
||||
logfile=cloudbase-init.log
|
||||
default_log_levels=comtypes=INFO,suds=INFO,iso8601=WARN,requests=WARN
|
||||
logging_serial_port_settings={{ cloudbase_logging_serial_port }}
|
||||
mtu_use_dhcp_config=true
|
||||
ntp_use_dhcp_config=true
|
||||
local_scripts_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\LocalScripts\
|
||||
|
||||
san_policy=OnlineAll
|
||||
trim_enabled=True
|
||||
|
||||
metadata_report_provisioning_started=True
|
||||
metadata_report_provisioning_completed=True
|
||||
ephemeral_disk_volume_label="Temporary Storage"
|
||||
netbios_host_name_compatibility={{ netbios_host_name_compatibility }}
|
||||
|
||||
metadata_services={{ cloudbase_metadata_services }}
|
||||
plugins=cloudbaseinit.plugins.common.userdata.UserDataPlugin,
|
||||
{{ cloudbase_plugins }}
|
Reference in New Issue
Block a user