306
306
307
307
- name: Install docker #<1>
308
308
ansible.builtin.apt: #<2>
309
- name: docker #<3>
309
+ name: docker.io #<3>
310
310
state: latest
311
311
update_cache: true
312
312
become: true
331
331
around the `apt` Debian & Ubuntu package management tool.
332
332
333
333
<3> Each module then provides a bunch of parameters which control how it works.
334
- Here we specify the `name` of the package we want to install ("docker")
334
+ Here we specify the `name` of the package we want to install ("docker.io"footnote:[
335
+ In the official docker installation instructions, you'll see a recommendation to install docker via a private package repository.
336
+ I wanted to avoid that complexity for the book, but you should probably follow those instructions in a real-world scenario.])
335
337
and tell it to update its cache first, which is required on a fresh server.
336
338
337
339
Most Ansible modules have pretty good documentation,
@@ -340,6 +342,7 @@ I often skip to the
340
342
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/apt_module.html#examples[Examples section].
341
343
342
344
// RITA: Please add a sentence or two to introduce the following code block.
345
+
343
346
[subs="specialcharacters,quotes"]
344
347
----
345
348
$ *ansible-playbook --user=elspeth -i staging.ottg.co.uk, infra/ansible-provision.yaml -vv*
@@ -392,6 +395,9 @@ computer Mother, in _Alien_.
392
395
Ansible scripts are particularly satisfying in this regard.
393
396
394
397
398
+ TIP: You may need to use the `--ask-become-pass` argument to `ansible-playbook`
399
+ if you get an error "Missing sudo password".
400
+
395
401
396
402
=== SSHing Into the Server and Viewing Container Logs
397
403
@@ -472,7 +478,7 @@ In Ansible config, it looks like this:
472
478
tasks:
473
479
- name: Install docker
474
480
ansible.builtin.apt:
475
- name: docker
481
+ name: docker.io
476
482
state: latest
477
483
become: true
478
484
@@ -1000,7 +1006,8 @@ and reloads it automatically if it crashes.
1000
1006
*******************************************************************************
1001
1007
1002
1008
A few more places to look and things to try, now that we've introduced
1003
- Docker into the mix, should things not go according to plan:
1009
+ Docker into the mix, should things not go according to plan--all of these
1010
+ should be run on the server, inside an SSH session:
1004
1011
1005
1012
- You can check the Container logs using
1006
1013
`docker logs superlists`.
0 commit comments