1 00:00:07,100 --> 00:00:08,950 - So, what do we have? 2 00:00:08,950 --> 00:00:10,920 We have these playbooks. 3 00:00:10,920 --> 00:00:11,960 There is docker_main. 4 00:00:11,960 --> 00:00:15,317 Okay, let's move docker_main.yaml 5 00:00:18,399 --> 00:00:20,149 to runcontainer.yaml. 6 00:00:22,240 --> 00:00:23,930 Or move, let's just copy it. 7 00:00:23,930 --> 00:00:26,053 Backwards compatibility is always good. 8 00:00:27,060 --> 00:00:30,560 So runcontainer, and there we have podman.yaml, 9 00:00:30,560 --> 00:00:35,560 and I'm going to copy podman.yaml to podman-rh.yaml. 10 00:00:37,930 --> 00:00:39,470 I hope you see what is coming here. 11 00:00:39,470 --> 00:00:41,416 I wanna do something creative here. 12 00:00:41,416 --> 00:00:46,400 So let me start with podman-rh.yaml, 13 00:00:46,400 --> 00:00:50,020 where I am going to make sure that, well, 14 00:00:50,020 --> 00:00:53,890 the hosts is what we are going to do later. 15 00:00:53,890 --> 00:00:55,960 The collections, that is what we need. 16 00:00:55,960 --> 00:00:57,750 So I'm going to use include_playbook. 17 00:00:57,750 --> 00:00:59,590 We haven't done that too often, 18 00:00:59,590 --> 00:01:01,349 but I'm going to use include_playbook 19 00:01:01,349 --> 00:01:05,540 to make that a conditional playbook inclusion. 20 00:01:05,540 --> 00:01:10,540 So I am going to work with the runcontainer, 21 00:01:12,968 --> 00:01:14,635 and in runcontainer, 22 00:01:16,570 --> 00:01:18,767 I'm using include_playbook 23 00:01:23,980 --> 00:01:28,170 podman-rh.yaml. 24 00:01:28,170 --> 00:01:29,900 And when are we going to do that? 25 00:01:29,900 --> 00:01:33,140 Well, we are going to do that when ansible_facts, 26 00:01:36,050 --> 00:01:39,020 and then it's easy to make the mistake. 27 00:01:39,020 --> 00:01:40,550 It's not distribution_family. 28 00:01:40,550 --> 00:01:41,770 It's os_family 29 00:01:46,510 --> 00:01:47,420 equals 30 00:01:52,750 --> 00:01:53,583 Rocky. 31 00:01:55,533 --> 00:01:58,060 Do we care about RedHat? 32 00:01:58,060 --> 00:02:01,500 Okay, okay, we do care about RedHat, 33 00:02:01,500 --> 00:02:03,167 or ansible_facts 34 00:02:06,298 --> 00:02:10,180 os_family 35 00:02:17,090 --> 00:02:19,173 equals RedHat. 36 00:02:21,610 --> 00:02:22,850 This is not going to work. 37 00:02:22,850 --> 00:02:25,750 We need to make sure that we can wrap the argument to when 38 00:02:25,750 --> 00:02:27,230 over multiple lines. 39 00:02:27,230 --> 00:02:28,810 This should be working. 40 00:02:28,810 --> 00:02:32,130 So podman-rh.yaml is going to be included, 41 00:02:32,130 --> 00:02:34,790 and let's go check it out, 42 00:02:34,790 --> 00:02:39,470 ansible-playbook runcontainer.yaml. 43 00:02:39,470 --> 00:02:44,200 And uh-oh, we can see this task include_playbook 44 00:02:44,200 --> 00:02:48,573 has extra parameters which is only allowed in. 45 00:02:50,040 --> 00:02:51,770 Well, if that is not allowed in, 46 00:02:51,770 --> 00:02:55,210 then we go for a different approach. 47 00:02:55,210 --> 00:02:56,890 You know the different approach. 48 00:02:56,890 --> 00:02:59,660 I have information in the playbook header. 49 00:02:59,660 --> 00:03:03,130 I'm not comfortable using Ansible playbook include anyway. 50 00:03:03,130 --> 00:03:05,599 I'm making it ansible_tasks, 51 00:03:05,599 --> 00:03:08,350 and in the ansible_tasks, well, 52 00:03:08,350 --> 00:03:11,580 we are going to use the collections right here. 53 00:03:11,580 --> 00:03:12,790 What was the name again? 54 00:03:12,790 --> 00:03:14,040 I don't remember the name, 55 00:03:14,040 --> 00:03:17,610 but we will find that soon enough in podman-rh. 56 00:03:17,610 --> 00:03:22,560 So cat podman-rh.yaml, 57 00:03:22,560 --> 00:03:26,020 where we can see collections hyphen containers.podman. 58 00:03:26,020 --> 00:03:28,283 So we need hyphen containers.podman. 59 00:03:29,160 --> 00:03:32,463 There we go, containers.podman. 60 00:03:33,480 --> 00:03:37,693 And then we need to tweak the podman-rh.yaml. 61 00:03:40,740 --> 00:03:45,740 So we can delete six lines or so. 62 00:03:47,350 --> 00:03:49,030 This line, as well. 63 00:03:49,030 --> 00:03:51,690 This is falling within the scope of the tasks, 64 00:03:51,690 --> 00:03:54,283 so just a list of tasks should be doing it. 65 00:03:55,390 --> 00:03:56,370 Is that so? 66 00:03:56,370 --> 00:03:57,940 Let's get back to runcontainer. 67 00:03:57,940 --> 00:03:59,440 Yeah, we have a list of tasks 68 00:03:59,440 --> 00:04:00,980 and we have include statements 69 00:04:00,980 --> 00:04:05,350 to include the appropriate tasks whenever that is needed. 70 00:04:05,350 --> 00:04:08,913 So let's check and see if we are doing better this time. 71 00:04:16,352 --> 00:04:19,860 And there we can see it's not too happy about the CentOS 7. 72 00:04:19,860 --> 00:04:22,094 Do we care about the CentOS 7? 73 00:04:22,094 --> 00:04:23,210 I think not. 74 00:04:23,210 --> 00:04:25,980 We care about the fact that the playbook 75 00:04:25,980 --> 00:04:27,880 is running smoothly on all hosts. 76 00:04:27,880 --> 00:04:31,270 So instead of having one different playbook for Podman, 77 00:04:31,270 --> 00:04:33,350 one different playbook for Docker, 78 00:04:33,350 --> 00:04:36,300 we have one playbook taking care of Docker and Podman. 79 00:04:36,300 --> 00:04:37,333 Isn't that nice?