Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7f8359f

Browse files
committed
Add more information to droplet creation
Also, set tags in CloudFlare DNS.
1 parent749216a commit7f8359f

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

‎README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ ansible-playbook create.yml --extra-vars "host=pluto functional=web99 ssh_keys='
148148

149149
The playbook will create the server, as well as add DNS records on CloudFlare.
150150
Note, you must set`DO_API_TOKEN` and`CLOUDFLARE_TOKEN` in the environment to
151-
access these services.
151+
access these services. The droplet ID and IP address will be printed at the
152+
end of the playbook.
152153

153154
Then, to ensure you are connecting to the expected server, you should grab the
154155
SSH host keys via the DigitalOcean Droplet Console:
@@ -173,6 +174,12 @@ Finally, you should reboot the droplet. This is due to a bug in cloud-init on
173174
DigitalOcean, which generates a new machine ID after startup, causing system
174175
logs to be seem invisible.
175176

177+
This can be done from the Console, or via the CLI:
178+
179+
```
180+
doctl compute droplet-action reboot <droplet-id>
181+
```
182+
176183
Running Ansible
177184
---------------
178185

‎collections/requirements.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
collections:
33
-name:ansible.posix
44
-name:community.general
5-
version:">=2.0.0"
5+
version:">=8.0.0"
66
-name:community.digitalocean

‎create.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@
115115
map(attribute='ip_address') |
116116
first
117117
}}
118+
tags:
119+
-website
118120
zone:matplotlib.org
119121

120122
-name:Setup functional DNS for droplet on CloudFlare
@@ -124,8 +126,23 @@
124126
record:"{{ functional }}"
125127
type:CNAME
126128
value:"{{ host }}.matplotlib.org"
129+
tags:
130+
-website
127131
zone:matplotlib.org
128132

133+
-name:Print droplet info
134+
ansible.builtin.debug:
135+
msg:
136+
-"Droplet ID is {{ new_droplet.data.droplet.id }}"
137+
->-
138+
First Public IPv4 is {{
139+
(new_droplet.data.droplet.networks.v4 | selectattr('type', 'equalto', 'public')).0.ip_address |
140+
default('<none>', true) }}
141+
->-
142+
First Private IPv4 is {{
143+
(new_droplet.data.droplet.networks.v4 | selectattr('type', 'equalto', 'private')).0.ip_address |
144+
default('<none>', true) }}
145+
129146
vars:
130147
# We currently name servers based on planets in the Solar System.
131148
valid_planets:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp